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:

  1. Basic product rules, such as field changes cross categories.
  2. Product system fields, like "gmt_modified" and "gmt_create".
  3. Special fields on product web page, like "keywords".

Parameters

FieldTypeDescription
ActionstringUpdateProduct
Name of the API that is to be called. Mandatory.
FormatstringThe response format, with XML as the default. Can be XML or JSON. Optional.
TimestampdatetimeThe current time in ISO8601 format (e.g., Timestamp=2016-04-01T10:00:00+02:00 for Berlin). Mandatory.
UserIDstringThe ID of the user making the call. Mandatory.
VersionstringThe API version against which this call is to be executed. The current version is "1.0". Mandatory.
SignaturestringThe 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

NameTypeDescription
ProductsubsectionThe product data node. Mandatory
PrimaryCategoryintegerThe ID of the primary category for this product. To get the ID of all categories, call GetCategoryTree. Optional
SPUIdintegerThe ID of the SPU. Optional.
AttributessubsectionAll common attributes of products. Optional
SkussubsectionAn 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.

NameTypeDescription
namestringName of the product as shown to the customers. Optional
descriptionstringDescription 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_descriptionstringHighlights of the product. Optional
brandstringBrand name of the product. Optional
modelstringModel name of the product. Optional
warrantystringThe warranty time for the product. Optional
warranty_typestringThe warranty type of the product. Optional
color_familystringColor family. Optional
...stringOther attributes defined in the PrimaryCategory. Optional

An SKU contains the following tags.

NameTypeDescription
SellerSkustringA 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
activebooleanOne of the following values: 'true' or 'false'. Optional
pricedecimalThe product price. Not really a Double, but a Decimal. Optional
quantityintegerThe current level of inventory for this product. Optional
special_pricedecimalThe (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_datedatetimeTime 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_datedatetimeTime 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_heightstringPackage height. Optional
package_lengthstringPackage length. Optional
package_widthstringPackage width. Optional
package_weightstringPackage weight. Optional
package_contentstringPackage Content. Optional
ImagessubsectionContains at most 8 image URLs. Optional
ImagestringThe 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 codeMessage
1E001: Parameter %s is mandatory
5E005: Invalid Request Format
6E006: Unexpected internal error
30E030: Empty Request
201E201: %s Invalid CategoryId
202E202: %s Invalid SPUId
501E501: Update product failed
901E901: The request is too frequent, or the requested functionality is temporarily disabled.
1000Internal Application Error