UpdateProduct
Definition
Use this call to update attributes or SKUs of an existing product. Note that one request can update only 1 product.
Request URI: https://api.sellercenter.lazada.sg?Action=UpdateProduct
Note: The following fields cannot be updated with the UpdateProduct call:
- Basic product rules, such as field changes cross categories.
- Product system fields, like "gmt_modified" and "gmt_create".
- Special fields on product web page, like "keywords".
Parameters
Field | Type | Description |
---|---|---|
Action | string | UpdateProduct Name of the API that is to be called. Mandatory. |
Format | string | The response format, with XML as the default. Can be XML or JSON. Optional. |
Timestamp | datetime | The current time in ISO8601 format (e.g., Timestamp=2016-04-01T10:00:00+02:00 for Berlin). Mandatory. |
UserID | string | The ID of the user making the call. Mandatory. |
Version | string | The API version against which this call is to be executed. The current version is "1.0". Mandatory. |
Signature | string | The cryptographic signature, authenticating the request. You must create this value by computing the SHA256 hash of the request, using the API key of the user specified in the UserID parameter. Mandatory. |
Code sample
# UpdateProduct cURL example. to run, update Timestamp and recompute Signature
#
url = "https://api.sg.ali-lazada.com/"
post
data-urlencode Action=UpdateProduct
data-urlencode Timestamp=2016-07-18T11:11+0000
data-urlencode [email protected]
data-urlencode Version=1.0
data-urlencode Signature=9ade00fb4b9ab9ed1b8a4d189f1a13e1029edc25dd963235480ec69226fd9f39
//construct attributes of product
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("name", "yucheng's first product");
attributes.put("package_height", 11.3);
//construct SKUs
List<Map<String, Object>> skusList = new ArrayList<>();
Map<String, Object> sku1 = new HashMap<String, Object>();
sku1.put("SellerSku", "yucheng-test-sku-2017020305");
sku1.put("package_height", 11.3);
sku1.put("storage_capacity_new", "128G");
skusList.add(sku1);
Map<String, Object> sku2 = new HashMap<String, Object>();
sku2.put("SellerSku", "yucheng-test-sku-2017020306");
sku2.put("package_height", 11.2);
skusList.add(sku2);
UpdateProduct request = new UpdateProduct(attributes, skusList);
try {
ModifyProductResponse response = request.execute();
System.out.println("UpdateProduct succeed?" + response.getBody());
} catch (LazadaException e) {
System.out.println(e.getResponseStr());
}
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<Request>
<Product>
<Attributes>
<name>api update product sample</name>
<short_description>This is an amazing product</short_description>
</Attributes>
<Skus>
<Sku>
<SellerSku>api-create-test-1</SellerSku>
<quantity>88</quantity>
<price>350</price>
<package_length>12</package_length>
<package_height>23</package_height>
<package_weight>34</package_weight>
<package_width>45</package_width>
<Images></Images>
</Sku>
<Sku>
<SellerSku>api-create-test-2</SellerSku>
<quantity>44</quantity>
<price>488.88</price>
<package_length>10</package_length>
<package_height>21</package_height>
<package_weight>32</package_weight>
<package_width>43</package_width>
<package_content>this is what's in the box, update</package_content>
<Images>
<Image>http://sg.s.alibaba.lzd.co/original/59046bec4d53e74f8ad38d19399205e6.jpg</Image>
<Image>http://sg.s.alibaba.lzd.co/original/179715d3de39a1918b19eec3279dd482.jpg</Image>
<Image>http://sg.s.alibaba.lzd.co/original/e2ae2b41afaf310b51bc5764c17306cd.jpg</Image>
</Images>
</Sku>
</Skus>
</Product>
</Request>
Response
Name | Type | Description |
---|---|---|
Product | subsection | The product data node. Mandatory |
PrimaryCategory | integer | The ID of the primary category for this product. To get the ID of all categories, call GetCategoryTree. Optional |
SPUId | integer | The ID of the SPU. Optional. |
Attributes | subsection | All common attributes of products. Optional |
Skus | subsection | An array contains at least one SKU. Mandatory |
Some example fields in 'Attributes' are as follows. These attributes are dynamic. For the list of all attributes, call API GetCategoryAttributes.
Name | Type | Description |
---|---|---|
name | string | Name of the product as shown to the customers. Optional |
description | string | Description of the product, as shown to the customers (6 to 25000 characters). Embedding certain HTML tags is allowed, but must be escaped as character data (see below). Optional |
short_description | string | Highlights of the product. Optional |
brand | string | Brand name of the product. Optional |
model | string | Model name of the product. Optional |
warranty | string | The warranty time for the product. Optional |
warranty_type | string | The warranty type of the product. Optional |
color_family | string | Color family. Optional |
... | string | Other attributes defined in the PrimaryCategory. Optional |
An SKU contains the following tags.
Name | Type | Description |
---|---|---|
SellerSku | string | A unique identifier for the product within the Seller Center instance that is to be added to the system. This identifier is usually freely assigned. Harmonized identifiers, such as UPC or EAN can be set via ProductId. Mandatory |
active | boolean | One of the following values: 'true' or 'false'. Optional |
price | decimal | The product price. Not really a Double, but a Decimal. Optional |
quantity | integer | The current level of inventory for this product. Optional |
special_price | decimal | The (hopefully reduced) price for the product while it is on sale. If special_price is specified, either special_from_date or special_to_date must be given; vice versa, if at least one of special_from_date or special_to_date is specified. Not really a Double, but a Decimal. Optional |
special_from_date | datetime | Time and date when the product goes on sale. If passed in, special_price becomes mandatory. The value of 'Time' is accepted in intervals of 15 mins. (For ex: 2017-07-15 18:23 will be converted to 2017-07-15 18:15) |
special_to_date | datetime | Time and date when the product sale ends. If passed in, special_price becomes mandatory. The value of 'Time' is accepted in intervals of 15 mins. (For ex: 2017-07-15 18:23 will be converted to 2017-07-15 18:15) |
package_height | string | Package height. Optional |
package_length | string | Package length. Optional |
package_width | string | Package width. Optional |
package_weight | string | Package weight. Optional |
package_content | string | Package Content. Optional |
Images | subsection | Contains at most 8 image URLs. Optional |
Image | string | The image URL. Optional. If you need to update images, use the UploadImages or MigrateImages call to get the image URLs first. This will ensure the success rate of updating products. |
Result sample
A success example is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
<Head>
<RequestId/>
<RequestAction>UpdateProduct</RequestAction>
<ResponseType>Product</ResponseType>
<Timestamp>2016-07-07T20:12:14+0700</Timestamp>
</Head>
<Body/>
</SuccessResponse>
{
"SuccessResponse": {
"Head": {
"RequestId": "",
"RequestAction": "UpdateProduct",
"ResponseType": "Product",
"Timestamp": "2016-07-07T20:12:14+0700"
},
"Body": {
"Warnings": []
}
}
}
A failure example is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<ErrorResponse>
<Head>
<RequestAction>UpdateProduct</RequestAction>
<ErrorType>Platform</ErrorType>
<ErrorCode>1000</ErrorCode>
<ErrorMessage>Format Error Detected</ErrorMessage>
</Head>
<Body/>
</ErrorResponse>
Error messages
Error code | Message |
---|---|
1 | E001: Parameter %s is mandatory |
5 | E005: Invalid Request Format |
6 | E006: Unexpected internal error |
30 | E030: Empty Request |
201 | E201: %s Invalid CategoryId |
202 | E202: %s Invalid SPUId |
501 | E501: Update product failed |
901 | E901: The request is too frequent, or the requested functionality is temporarily disabled. |
1000 | Internal Application Error |
Updated almost 7 years ago