SetImages
Definition
Use this call to set the images for an existing product by associating one or more image URLs with it. System supports a maximum of 100 SellerSkus in one request. The first image passed in becomes the default image of the product. There is a hard limit of at most 8 images per SKU. You can also use the “UpdateProduct” call to set images.
Request URI: https://api.sellercenter.lazada.sg?Action=SetImages
Parameters
Field | Type | Description |
---|---|---|
Action | string | SetImages 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
# SetImages cURL example
# to run, update Timestamp and recompute Signature
#
url = "https://api.sg.ali-lazada.com/"
post
data-urlencode Action=SetImages
data-urlencode Timestamp=2016-07-18T11:11+0000
data-urlencode UserID=maintenance@sellercenter.net
data-urlencode Version=1.0
data-urlencode Signature=9ade00fb4b9ab9ed1b8a4d189f1a13e1029edc25dd963235480ec69226fd9f39
//map from seller sku to image list
Map<String, List<String>> sku2Images = new HashMap<>();
sku2Images.put("100024306", Arrays.asList("http://id-live-03.slatic.net//cms/banners2016/112016/sbd12.jpg",
"http://id-live-03.slatic.net//cms/banners2016/112016/sbd4.jpg"));
sku2Images.put("100024305", Arrays.asList("http://id-live-03.slatic.net//cms/banners2016/112016/sbd-banner-2.jpg"));
SetImages createProduct = new SetImages(sku2Images);
try {
ModifyProductResponse response = createProduct.execute();
System.out.println(String.format("SetImages succeeded?%b",response.getBody()));
} catch (LazadaException e) {
e.printStackTrace();
System.out.println(e.getResponseStr());
}
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<Request>
<Product>
<Skus>
<Sku>
<SellerSku>Nike Air white</SellerSku>
<Images>
<Image>http://static.somecdn.com/img1.jpeg</Image>
<Image>http://static.somecdn.com/img2.jpeg</Image>
<Image>http://static.somecdn.com/img3.jpeg</Image>
<Image>http://static.somecdn.com/img4.jpeg</Image>
<Image>http://static.somecdn.com/img5.jpeg</Image>
<Image>http://static.somecdn.com/img6.jpeg</Image>
<Image>http://static.somecdn.com/img7.jpeg</Image>
<Image>http://static.somecdn.com/img8.jpeg</Image>
</Images>
</Sku>
<Sku>
<SellerSku>Nike Air black</SellerSku>
<Images>
<Image>http://static.somecdn.com/img11.jpeg</Image>
<Image>http://static.somecdn.com/img12.jpeg</Image>
<Image>http://static.somecdn.com/img13.jpeg</Image>
<Image>http://static.somecdn.com/img14.jpeg</Image>
<Image>http://static.somecdn.com/img15.jpeg</Image>
<Image>http://static.somecdn.com/img16.jpeg</Image>
<Image>http://static.somecdn.com/img17.jpeg</Image>
<Image>http://static.somecdn.com/img18.jpeg</Image>
</Images>
</Sku>
</Skus>
</Product>
</Request>
If you want to remove some images, remove the tags with the image URLs. See the following example.
<?xml version="1.0" encoding="UTF-8" ?>
<Request>
<Product>
<Skus>
<Sku>
<SellerSku>Nike Air white</SellerSku>
<Images>
<Image>http://static.somecdn.com/img1.jpeg</Image>
<Image>http://static.somecdn.com/img2.jpeg</Image>
<Image>http://static.somecdn.com/img3.jpeg</Image>
<Image>http://static.somecdn.com/img4.jpeg</Image>
</Images>
</Sku>
</Skus>
</Product>
</Request>
Response
Name | Type | Description |
---|---|---|
Skus | subsection | An array contains at least one SKU. Mandatory |
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 |
Images | subsection | Contains at most 8 image URLs. Optional |
Image | string | The image URL. Optional |
Result sample
A success example is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
<Head>
<RequestId/>
<RequestAction>SetImages</RequestAction>
<ResponseType>Product</ResponseType>
<Timestamp>2016-07-07T20:12:14+0700</Timestamp>
</Head>
<Body/>
</SuccessResponse>
{
"SuccessResponse": {
"Head": {
"RequestId": "",
"RequestAction": "SetImages",
"ResponseType": "Product",
"Timestamp": "2016-08-26T06:57:26+0000"
},
"Body": {
"Warnings": []
}
}
}
Error messages
Error code | Message |
---|---|
5 | E005: Invalid Request Format |
6 | E006: Unexpected internal error |
30 | E030: Empty Request |
200 | E200: Empty SellerSku |
203 | E203: Too many images in one SKU |
204 | E204: Too many SKU in one request |
504 | E504: Set product Image failed |
1000 | Internal Application Error |
Updated about 7 years ago