SearchSPUs
Definition
Use this call to search SPU information by category and some keywords. The maximum number of SPUs is 100 in the response body.
Request URI: https://api.sellercenter.lazada.sg?Action=SearchSPUs
Parameters
Field | Type | Description |
---|---|---|
Action | string | SearchSPUs 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. |
CategoryId | string | The ID of the primary category. To get the ID for each of the system's categories, call GetCategoryTree. Optional. |
Search | string | Returns those SPUs where the search string is contained in the SPU's name or brand or model. It will return all SPUs when search word is empty. Optional. |
Offset | integer | Number of SPUs to skip (i.e., an offset into the result set; together with the Limit parameter, simple result set paging is possible; if you do page through results, note that the list of products might change during paging). |
Limit | integer | The maximum number of products that can be returned. If you omit this parameter, the default of 100 is used. The largest number of SPUs you can request with a single call is 500 (this is the default hard limit, which can be changed per instance). If you need to retrieve more products than that, you have to page through the result set using the Offset parameter. |
Code sample
# SearchSPUs cURL example
# to run, update Timestamp and recompute Signature
#
url = "https://api.sg.ali-lazada.com/"
post
data-urlencode Action=SearchSPUs
data-urlencode Timestamp=2016-07-18T11:11+0000
data-urlencode [email protected]
data-urlencode Version=1.0
data-urlencode Signature=9ade00fb4b9ab9ed1b8a4d189f1a13e1029edc25dd963235480ec69226fd9f39
data-urlencode CategoryId=1628
data-urlencode Search=Apple iphone
data-urlencode Offset=1
//1.search by keyword
//SearchSPUs searchSPUs = new SearchSPUs("Apple");
//2.search by category Id
//SearchSPUs searchSPUs = new SearchSPUs(3L);
//3.search by category Id and keyword
//SearchSPUs searchSPUs = new SearchSPUs(3L, "Apple");
//4.search with paging
SearchSPUs searchSPUs = new SearchSPUs(3L, "Apple", 0, 100);
try {
SearchSPUsResponse response = searchSPUs.execute();
for(SPU spu: response.getBody().getSpus()) {
System.out.println(spu);
}
} catch (LazadaException e) {
System.out.println(e.getResponseStr());
}
Response
Name | Type | Description |
---|---|---|
SPUs | subsection | SPU structure list. Mandatory |
SPU | subsection | SPU structure. Mandatory |
SPUId | string | The ID of SPU. Mandatory |
PrimaryCategory | integer | The ID of the primary category for his product. |
SPUName | string | The name of SPU. |
Attributes | subsection | All the attributes belong to current SPU. |
Some example fields in 'Attributes':
Name | Type | Description |
---|---|---|
brand | string | The brand name of the product. Optional |
model | string | The model name of the product. Optional |
... | Other attributes defined in the SPU. |
Result sample
<?xml version="1.0" encoding="UTF-8"?>
<SuccessResponse>
<Head>
<RequestId>
</RequestId>
<RequestAction>SearchSPUs</RequestAction>
<ResponseType>SPU</ResponseType>
<Timestamp>2016-08-25T10:12:41+0000</Timestamp>
</Head>
<Body>
<SPUs>
<SPU>
<SPUId>13408</SPUId>
<PrimaryCategory>3</PrimaryCategory>
<SPUName>Mobiles Apple 5S</SPUName>
<Attributes>
<Brand>Apple</Brand>
<Model>5S</Model>
</Attributes>
</SPU>
<SPU>
<SPUId>13334</SPUId>
<PrimaryCategory>3</PrimaryCategory>
<SPUName>Mobiles Apple 6S</SPUName>
<Attributes>
<Brand>Apple</Brand>
<Model>6S</Model>
</Attributes>
</SPU>
<SPU>
<SPUId>13333</SPUId>
<PrimaryCategory>6620</PrimaryCategory>
<SPUName>T-Shirts & Shirts Daiichi Apple steve job inspiring t-shirt</SPUName>
<Attributes>
<Brand>Daiichi</Brand>
<Model>Apple steve job inspiring t-shirt</Model>
</Attributes>
</SPU>
</SPUs>
</Body>
</SuccessResponse>
{
"SuccessResponse": {
"Head": {
"RequestId": "",
"RequestAction": "SearchSPUs",
"ResponseType": "SPU",
"Timestamp": "2016-08-25T11:27:32+0000"
},
"Body": {
"SPUs": [
{
"SPUId": 13410,
"PrimaryCategory": 3,
"SPUName": "Mobiles Apple 5S",
"Attributes": {
"Brand": "Apple",
"Model": "5S"
}
},
{
"SPUId": 13334,
"PrimaryCategory": 3,
"SPUName": "Mobiles Apple 6S",
"Attributes": {
"Brand": "Apple",
"Model": "6S"
}
},
{
"SPUId": 281,
"PrimaryCategory": 3,
"SPUName": "Mobiles Isotonix apple 7s",
"Attributes": {
"Brand": "Isotonix",
"Model": "apple 7s"
}
}
]
}
}
}
Error messages
Error code | Message |
---|---|
5 | E005: Invalid Request Format |
14 | E014: %s Invalid Offset |
19 | E019: %s Invalid Limit |
30 | E030: Empty Request |
201 | E201: %s Invalid CategoryId |
502 | E502: Search SPU failed |
1000 | Format Error Detected |
Updated about 7 years ago