MigrateImage

Definition

Use this call to migrate a single image from an external site to Lazada site. Allowed image formats are JPG and PNG. The maximum size of an image file is 1MB.

Request URI: https://api.sellercenter.lazada.sg?Action=MigrateImage

Parameters

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

# MigrateImage cURL example
# to run, update Timestamp and recompute Signature
#
url = "https://api.sg.ali-lazada.com/"
post
data-urlencode Action=MigrateImage
data-urlencode Timestamp=2016-07-18T11:11+0000
data-urlencode [email protected]
data-urlencode Version=1.0
data-urlencode Signature=9ade00fb4b9ab9ed1b8a4d189f1a13e1029edc25dd963235480ec69226fd9f39
//construct migrate request with url of the image 
MigrateImage migrateImage = new MigrateImage("http://www.google.cn/landing/cnexp/google-search.png");
try {
  ModifyImageResponse response = migrateImage.execute();
  System.out.println("New URL: " + response.getBody().getImage().getUrl());
  System.out.println("HashCode: " + response.getBody().getImage().getCode());
} catch (LazadaException e) {
  e.printStackTrace();
}

Response

The response body contains an image resource, which is composed of the following fields.

NameTypeDescription
UrlstringThe URL address of the migrated image.
CodestringThe hash code of the image.

Result sample

An example of successful response is as follows.

<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
  <Head>
    <RequestId>
    </RequestId>
    <RequestAction>MigrateImage</RequestAction>
    <ResponseType>Image</ResponseType>
    <Timestamp>2016-08-25T11:21:46+0000</Timestamp>
  </Head>
  <Body>
    <Image>
    <Url>https//sg.s.alibaba.lzd.co/original/1e8bb2499d38084ffe31f155c68e0d1f.jpg</Url>
      <Code>1e8bb2499d38084ffe31f155c68e0d1f</Code>
    </Image>
  </Body>
</SuccessResponse>
{
    "SuccessResponse": {
        "Head": {
            "RequestId": "",
            "RequestAction": "MigrateImage",
            "ResponseType": "Image",
            "Timestamp": "2016-08-25T11:23:29+0000"
        },
        "Body": {
            "Image": {
                "Url": "https//sg.s.alibaba.lzd.co/original/1e8bb2499d38084ffe31f155c68e0d1f.jpg",
                "Code": "1e8bb2499d38084ffe31f155c68e0d1f"
            }
        }
    }
}

Error messages

Error codeMesssage
5E005: Invalid Request Format
6E006: Unexpected internal error
30E030: Empty Request
301E301: Migrate Image Failed
302E302: Not supported URL.
303E303: The image is too large
901E901: The request is too frequent, or the requested functionality is temporarily disabled.
1000Internal Application Error.