Product set import

Function productSet/import (http://<DOMAIN>/api/productSet/import/)

Parameters:

  • token - authorization key obtained through the auth function
  • items[] - list of sets
    • items[i].article - article of the set (mandatory parameter). It must be unique within sets and items
    • items[i].title - name of the set. The default is "Cheaper Together"
    • items[i].discountPercent - relative discount on the kit relative to the original price.
    • items[i].initialPrice - initial price of the set. If not specified, the cost of all items in the set is summarized
    • items[i].discountedPrice - the cost of the set with the discount taken into account. If not specified, it will be calculated automatically relative to the parameters "initialPrice" and "discountPercent".
    • items[i].currency - ISO currency code of the set
    • items[i].enabled - enable kit (boolean)
    • items[i].sortOrder - order of displaying the kit. The lower the value, the higher the priority
    • items[i].products[] - list of items that form the kit. Not less than two and, by default, not more than five items (the setting can be changed).
      • items[i].products[n] - article of the item in the set

Response:

  • status - status of the function execution
    • OK - all sets of goods were successfully added/updated
    • WARNING - one or more sets of goods were not added/updated
  • response.log - log of function execution for each record
    • response.log[i].article - set article
    • response.log[i]['info'][n].code - record update status (see the code table below)
    • response.log[i]['info'][n].message - code explanation


Set import log codes

CodesDescription
0

Set imported

1

The "discountPercent" parameter must be an integer between 0 and 100

2

The parameter "initialPrice" must be a fractional number higher than 0

3

The "discountedPrice" parameter must be a fractional number higher than O

4

The number of items in the set must be between 2 and the "maximum allowed number of items configured on the site".

5

The items in the set must not be repeated

101

The parameter "article" is mandatory

102

The set article cannot match the article of an existing product.

103

The "products" parameter is mandatory

104Product with a certain article is not found
105No article is specified for one of the items in the set
106

Currency not found

400

"The payload is not JSON". The request is made incorrectly.

1000

One of the products has an incorrect object type

2000Unknown error
Query example http://<DOMAIN>/api/productSet/import/
{  
    "token": "24a75d0678c49a34030e35baeb376ff3",
    "items":[  
        {  
            "article":"PRODUCT_SET_ARTICLE",
            "title":"PRODUCT_SET_TITLE",
            "discountPercent":5,
            "initialPrice":150,
            "discountedPrice":100,
            "currency":"UAH",
            "enabled":true,
            "sortOrder":1,
            "products":[  
                "2317217",
                "MB829",
                "MD810"
            ]
        },
        {  
            "article":"2317217",
            "title":"PRODUCT_SET_TITLE",
            "discountPercent":5,
            "initialPrice":150,
            "discountedPrice":100,
            "currency":"USD",
            "enabled":false,
            "sortOrder":2,
            "products":[  
                "2317217",
                "MB829",
                "MD810",
                "MGR32",
                "MGTR2",
                "MD565"
            ]
        }
    ]
}
Response example
{  
    "status":"WARNING",
    "response":{  
        "log":[  
            {  
                "article":"PRODUCT_SET_ARTICLE",
                "info":[  
                    {  
                        "code":0,
                        "message":"Set imported"
                    }
                ]
            },
            {  
                "article":"2317217",
                "info":[  
                    {  
                        "code":102,
                        "message":"The set article \"2317217\" cannot match the article of an existing product"
                    }
                ]
            }
        ]
    }
}