getProductVariants

Method returns matching variants for selected product and category. Both parameters are required. Returns an array of objects/dictionaries in following structure:

Usage URL: https://b2b.onesto-energy.pl/api/getProductVariants.json?key=YOURAPIKEY

Query params

(put those in your URL, e.g. ?id=123)

  • id | required

    integer

    Internal identifier of product.

  • categoryid | required

    integer

    Internal identifier of category.

  • lang

    string

    Language of result. ISO 2 Letter Language Codes ie

    Example: en, pl, cs

  • groupname

    string

    Name of product variant grouping attribute

  • attributeid

    integer

    Internal identifier of product attribute

  • type

    string

    'variant' - regular text variant, 'photo' - show thumbnails

  • unit

    string

    Unit of measure

  • subitems

    object[]

    Array of products matching given variant type

    • attributevalue

      string

      Value of variant attribute for selected product

    • productid

      integer

      Internal identifier of product

    • productname

      string

      Product name

    • thumbnail

      string

      Product thumbnail

    • instock

      boolean (1 = true, 0 = false)

      Indicates whether product is available or not. Can be used to quickly disable/mark product as sold out in variant section.

Example URL: https://b2b.onesto-energy.pl/api/getProductVariants.json?key=YOURAPIKEY&lang=pl&id=53259&categoryid=3405

[
   {
      "groupname":"Materiał",
      "attributeid":34,
      "subitems":[
         {
            "attributevalue":"Silikon",
            "productid":53278,
            "instock":true
         },
         {
            "attributevalue":"Stal nierdzewna",
            "productid":53259,
            "instock":true
         }
      ]
   },
   {
      "groupname":"Rodzaj zapięcia",
      "attributeid":43,
      "subitems":[
         {
            "attributevalue":"Inny",
            "productid":53259,
            "instock":true
         },
         {
            "attributevalue":"Magnes",
            "productid":53256,
            "instock":true
         }
      ]
   },
   {
      "groupname":"Kolor",
      "attributeid":33,
      "subitems":[
         {
            "attributevalue":"Czarny",
            "productid":53257,
            "instock":true
         },
         {
            "attributevalue":"Niebieski",
            "productid":53260,
            "instock":true
         },
         {
            "attributevalue":"Rose gold",
            "productid":53259,
            "instock":true
         },
         {
            "attributevalue":"Srebrno czarny",
            "productid":53262,
            "instock":true
         },
         {
            "attributevalue":"Srebrno rose gold",
            "productid":53264,
            "instock":true
         },
         {
            "attributevalue":"Srebrno złoty",
            "productid":53263,
            "instock":true
         },
         {
            "attributevalue":"Srebrny",
            "productid":53261,
            "instock":true
         },
         {
            "attributevalue":"Złoty",
            "productid":53258,
            "instock":true
         }
      ]
   }
]
Example URL: https://b2b.onesto-energy.pl/api/getProductVariants.xml?key=YOURAPIKEY&lang=en&id=53259&categoryid=3405

<?xml version="1.0" encoding="utf-8"?>
<root>
	<item>
		<groupname>Materiał</groupname>
		<attributeid>34</attributeid>
		<subitems>
			<item>
				<attributevalue>Silikon</attributevalue>
				<productid>53278</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Stal nierdzewna</attributevalue>
				<productid>53259</productid>
				<instock>1</instock>
			</item>
		</subitems>
	</item>
	<item>
		<groupname>Rodzaj zapięcia</groupname>
		<attributeid>43</attributeid>
		<subitems>
			<item>
				<attributevalue>Inny</attributevalue>
				<productid>53259</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Magnes</attributevalue>
				<productid>53256</productid>
				<instock>1</instock>
			</item>
		</subitems>
	</item>
	<item>
		<groupname>Kolor</groupname>
		<attributeid>33</attributeid>
		<subitems>
			<item>
				<attributevalue>Czarny</attributevalue>
				<productid>53257</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Niebieski</attributevalue>
				<productid>53260</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Rose gold</attributevalue>
				<productid>53259</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Srebrno czarny</attributevalue>
				<productid>53262</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Srebrno rose gold</attributevalue>
				<productid>53264</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Srebrno złoty</attributevalue>
				<productid>53263</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Srebrny</attributevalue>
				<productid>53261</productid>
				<instock>1</instock>
			</item>
			<item>
				<attributevalue>Złoty</attributevalue>
				<productid>53258</productid>
				<instock>1</instock>
			</item>
		</subitems>
	</item>
</root>