DRAFT Promotion.setPromotionProducts

Request

Name

Type

Mandatory

Description

id_promotion

integer

yes

id of the Promotion to which the prices will be applied

products

array

yes

a two-dimensional array to set multiple prices and stocks for a collection of skus. The elements respond to the Promotion Price and Stock Data Structure

Promotion products datastructure

Name

Type

Mandatory

Description

sku

string

yes

SKU (Shop SKU) of the product to which the Price will be assigned

price

string

yes

Price that applies to this sku in the addressed Promotion. Setting this value to "null" should remove the Product from the Promotion in the shop system

stock

string

yes

Stock that applies to this sku in the addressed Promotion. Setting this value to "null" should remove the Product from the Promotion in the shop system

Please note

200 products per call

JSON example

Request :
[
   {
      "api":1,
      "method":"auth",
      "params":{
         "username":"sellercenter.cli",
         "password":"xxxxxxxx"
      },
      "id":1
   },
   {
      "api":1,
      "method":"Promotion.setPromotionProducts",
      "params":{
            "id_promotion":"78",
            "products":[
                {
                   "sku":"“ALCJLDJFFFVNAMZ­12334",
                   "price":"2100.00",
                   "stock":"50"
                },
                {
                   "sku":"“ALCJLDJFFFVNAMZ­00001",
                   "price":"wrongprice",
                   "stock":"10"
                },
                {
                   "sku":"“ALCJLDJFFFVNAMZ­00002",
                   "price":"2000.00",
                   "stock":"wrongstock"
                },
                {
                   "sku":"“ALCJLDJFFFVNAMZ­00003",
                   "price":null,
                   "stock":null
                }
         ]
      },
      "id":1
   }
]

Response

Return data structure

Name

Type

Mandatory

Description

status

string

yes

"success" / "failure" in case the full set of promotion products where saved successfully. "failure" indicates that at least one price was not saved.

error

string

no

stores any error happening at global level, therefore not attached to any Promotion Product in particular. eg: "Promotion does not exist"

failedProducts

array

no

contains detail of the Promotion Products that were not saved and the error in each case

failedPrices Structure Data

sku

string

yes

SKU of the failed Price as sent in the request

error

string

yes

Error preventing this Price and Stock to be applied. eg: "sku does not exist"

Return value (global error)

Response :
[
   {
      "api":1,
      "result":
         {
            "status":"failure",
            "error":"Promotion 78 does not exist"
      },
      "id":1
   }
]

Return Value (Errors on some Products)

Response :
[
   {
      "api":1,
      "result":
         {
            "status":"failure",
            "failedProducts":[
                {
                    "sku":"ALCJLDJFFFVNAMZ­00001",
                    "error":"Wrong price format"
                },
               {
                    "sku":"ALCJLDJFFFVNAMZ­00002",
                    "error":"Wrong stock format"
                }
            ]
      },
      "id":1
   }
]

Return value (fully successful)

Response :
[
   {
      "api":1,
      "result": {
            "status":"success"
      },
      "id":1
   }
]