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

FieldTypeDescription
ActionstringSetImages
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

# 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 [email protected]
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

NameTypeDescription
SkussubsectionAn array contains at least one SKU. Mandatory
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
ImagessubsectionContains at most 8 image URLs. Optional
ImagestringThe 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 codeMessage
5E005: Invalid Request Format
6E006: Unexpected internal error
30E030: Empty Request
200E200: Empty SellerSku
203E203: Too many images in one SKU
204E204: Too many SKU in one request
504E504: Set product Image failed
1000Internal Application Error