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
Field | Type | Description |
---|---|---|
Action | string | MigrateImage 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
# 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.
Name | Type | Description |
---|---|---|
Url | string | The URL address of the migrated image. |
Code | string | The 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 code | Messsage |
---|---|
5 | E005: Invalid Request Format |
6 | E006: Unexpected internal error |
30 | E030: Empty Request |
301 | E301: Migrate Image Failed |
302 | E302: Not supported URL. |
303 | E303: The image is too large |
901 | E901: The request is too frequent, or the requested functionality is temporarily disabled. |
1000 | Internal Application Error. |
Updated almost 7 years ago