stable本次发布有变化全部展示
来自 Shopee 官方资料快照 ·
- 当前资料结构化阅读页
- 固定快照已留存,可追溯
- 官方原文可核对
资料正文
§1 v2.merchant.get_merchant_warehouse_list
Get merchant warehouse with page
§2 Overview
Overview
| Field | Value |
|---|---|
| Module | Merchant |
| API type | Merchant |
| HTTP method | POST |
| Path | /api/v2/merchant/get_merchant_warehouse_list |
| Production URL | https://partner.shopeemobile.com/api/v2/merchant/get_merchant_warehouse_list |
| Sandbox URL | https://partner.test-stable.shopeemobile.com/api/v2/merchant/get_merchant_warehouse_list |
| Permission | ERP System; Seller In House System; Product Management; Swam ERP |
§3 Request parameters
Request parameters
| Name | Type | Required | Sample | Description |
|---|---|---|---|---|
| cursor | object | Yes | // how to use DoubleSidedCursor; // Get data for the first page: Please pass next_id = 0 or nil, page_size = {your page size}.; // Get data for the next page: Please pass the Cursor from the previous response, and set prev_id=nil;; // Get data for the prev page: Please pass the Cursor from the previous response, and set next_id=nil;; // Stop fetching next data: The Cursor.next_id in the previous response is nil.; // Stop fetching prev data: The Cursor.prev_id in the previous response is nil. | |
| cursor.next_id | int | No | ||
| cursor.prev_id | int | No | ||
| cursor.page_size | int | Yes | The size of one page. Limit is [1,30]. | |
| warehouse_type | int | Yes | 1 means pickup warehouse; 2 means return warehouse |
§4 Response parameters
Response parameters
| Name | Type | Required | Sample | Description |
|---|---|---|---|---|
| request_id | string | The identifier of the API request for error tracking. | ||
| error | string | Indicate error type if hit error. Empty if no error happened. | ||
| message | string | Indicate error details if hit error. Empty if no error happened. | ||
| response | object | |||
| response.total_count | int | Total count of all warehouses. | ||
| response.warehouse_list | object[] | |||
| response.warehouse_list.warehouse_id | int | Warehouse address identifier. | ||
| response.warehouse_list.warehouse_name | string | The warehouse name filled in when creating the warehouse. | ||
| response.warehouse_list.warehouse_type | int | 1 means pickup warehouse; 2 means return warehouse | ||
| response.warehouse_list.warehouse_region | string | Region of your warehouse. | ||
| response.warehouse_list.location_id | string | Location identifier for stocks. Different location_ids represent that your addresses are in different item stocks. | ||
| response.warehouse_list.address | object | |||
| response.warehouse_list.address.address_name | string | The address name filled in when creating the warehouse. | ||
| response.warehouse_list.address.region | string | Region of your warehouse address. | ||
| response.warehouse_list.address.address | string | Detail address of your warehouse address. | ||
| response.warehouse_list.address.city | string | City of your warehouse address. | ||
| response.warehouse_list.address.district | string | Distinct of your warehouse address. | ||
| response.warehouse_list.address.state | string | State of your warehouse address. | ||
| response.warehouse_list.address.town | string | Town of your warehouse address. | ||
| response.warehouse_list.address.zip_code | string | Zipcode of your warehouse address. | ||
| response.warehouse_list.enterprise_info | object | |||
| response.warehouse_list.enterprise_info.company_name | string | |||
| response.warehouse_list.enterprise_info.cnpj | string | |||
| response.warehouse_list.enterprise_info.state_registration_number | string | |||
| response.warehouse_list.enterprise_info.is_freight_payer | boolean | |||
| response.cursor | object | |||
| response.cursor.next_id | int | |||
| response.cursor.prev_id | int | |||
| response.cursor.page_size | int |
§5 Common parameters
Common parameters
| Name | Type | Required | Sample | Description |
|---|---|---|---|---|
| partner_id | int | 1 | Partner ID is assigned upon registration is successful. Required for all requests. | |
| timestamp | timestamp | 1610000000 | This is to indicate the timestamp of the request. Required for all requests. Expires in 5 minutes. | |
| access_token | string | c09222e3fc40ffb25fc947f738b1abf1 | The token for API access, using to identify your permission to the api. Valid for multiple use and expires in 4 hours. | |
| merchant_id | int | 1 | Shopee’s unique identifier for a merchant. Required for all merchant level requests(CB CNSC user calling global product related APIs). | |
| sign | string | e318d3e932719916a9f9ebb57e2011961bd47abfa54a36e040d050d8931596e2 | Signature generated by partner_id, api path, timestamp, access_token, merchant_id and partner_key via HMAC-SHA256 hashing algorithm. More details: https://open.shopee.com/documents?module=87&type=2&id=58&version=2 |
§6 Request samples
Request samples
§7 Payload
Payload
{
"warehouse_type": 1,
"cursor": {
"next_id": 0,
"page_size": 30
}
}
§8 Java
Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://open.admin.shopee.io/api/v2/merchant/get_merchant_warehouse_list?access_token=access_token&merchant_id=merchant_id&partner_id=partner_id&sign=sign×tamp=timestamp")
.header("Content-Type","application/json")
.body("{
\"cursor\": {
\"next_id\": 100,
\"page_size\": 30,
\"prev_id\": 100
}
}")
.asString();
§9 PHP
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://open.admin.shopee.io/api/v2/merchant/get_merchant_warehouse_list?access_token=access_token&merchant_id=merchant_id&partner_id=partner_id&sign=sign×tamp=timestamp',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"cursor": {
"next_id": 100,
"page_size": 30,
"prev_id": 100
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
§10 cURL
cURL
curl --location --request POST 'https://open.admin.shopee.io/api/v2/merchant/get_merchant_warehouse_list?access_token=access_token&merchant_id=merchant_id&partner_id=partner_id&sign=sign×tamp=timestamp' \
--header 'Content-Type: application/json' \
--data-raw '{
"cursor": {
"next_id": 100,
"page_size": 30,
"prev_id": 100
}
}'
§11 Python
Python
import requests
import json
url = "https://open.admin.shopee.io/api/v2/merchant/get_merchant_warehouse_list?access_token=access_token&merchant_id=merchant_id&partner_id=partner_id&sign=sign×tamp=timestamp"
payload=json.dumps({
"cursor": {
"next_id": 100,
"page_size": 30,
"prev_id": 100
}
})
headers = {
'Content-Type': 'application/json'
}
response = requests.RPCRequest("POST",url,headers=headers, data=payload, allow_redirects=False)
print(response.text)
§12 Response sample
Response sample
§13 JSON
JSON
{
"error": null,
"message": null,
"request_id": "9b73908eb0237c86670147a8883b7210",
"response": {
"cursor": {
"next_id": null,
"page_size": 30,
"prev_id": null
},
"total_count": 12,
"warehouse_list": [
{
"address": {
"address": "Calle Becal, MZ28 LT23, test",
"address_name": "mx tester",
"city": "Tlalpan",
"district": "Ciudad de México",
"region": "MX",
"state": "Ciudad de México",
"town": "Lomas de Padierna",
"zip_code": "14240"
},
"enterprise_info": null,
"location_id": "MX1004MQZ",
"warehouse_id": 10001027,
"warehouse_name": "MX Warehouse 1",
"warehouse_region": "MX",
"warehouse_type": 1
},
{
"address": {
"address": "Rodovia Raposo Tavares, 001",
"address_name": "xinjian chen",
"city": "Sorocaba",
"district": "Parque Reserva Fazenda Imperial",
"region": "BR",
"state": "São Paulo",
"town": "",
"zip_code": "18052775"
},
"enterprise_info": {
"cnpj": "52069476000182",
"company_name": "J.filho Comercio Atacado e Var",
"is_freight_payer": true,
"state_registration_number": "798873714116"
},
"location_id": "BR1004MQZ",
"warehouse_id": 10001024,
"warehouse_name": "BR Warehouse 1",
"warehouse_region": "BR",
"warehouse_type": 1
},
{
"address": {
"address": "南山街道",
"address_name": "yuangx",
"city": "深圳市",
"district": "南山区",
"region": "CN",
"state": "广东省",
"town": "",
"zip_code": "518000"
},
"enterprise_info": null,
"location_id": "CNZ",
"warehouse_id": 10001022,
"warehouse_name": "CN Warehouse",
"warehouse_region": "CN",
"warehouse_type": 1
},
{
"address": {
"address": "新北市樹林區味王街197號",
"address_name": "Jwadi",
"city": "樹林區",
"district": "",
"region": "TW",
"state": "新北市",
"town": "",
"zip_code": "238"
},
"enterprise_info": null,
"location_id": "TW1003UYZ",
"warehouse_id": 10001021,
"warehouse_name": "TW Warehouse 2",
"warehouse_region": "TW",
"warehouse_type": 1
},
{
"address": {
"address": "18 Mosque St,Singapore 059498, #2",
"address_name": "Grabovich",
"city": "",
"district": "",
"region": "SG",
"state": "",
"town": "",
"zip_code": "059498"
},
"enterprise_info": null,
"location_id": "SG1006Y4Z",
"warehouse_id": 10001020,
"warehouse_name": "SG Warehouse 2",
"warehouse_region": "SG",
"warehouse_type": 1
},
{
"address": {
"address": "11",
"address_name": "insed",
"city": "KAB. BADUNG",
"district": "ABIANSEMAL",
"region": "ID",
"state": "BALI",
"town": "",
"zip_code": "80352"
},
"enterprise_info": null,
"location_id": "ID1003VGZ",
"warehouse_id": 10001018,
"warehouse_name": "ID Warehouse 1",
"warehouse_region": "ID",
"warehouse_type": 1
},
{
"address": {
"address": "11",
"address_name": "Jerick Tolsky",
"city": "Batu Pahat",
"district": "",
"region": "MY",
"state": "Johor",
"town": "",
"zip_code": "16434"
},
"enterprise_info": null,
"location_id": "MY1004MSZ",
"warehouse_id": 10001017,
"warehouse_name": "MY Warehouse 1",
"warehouse_region": "MY",
"warehouse_type": 1
},
{
"address": {
"address": "12",
"address_name": "J Wa Neil",
"city": "อำเภอคลองท่อม",
"district": "ตำบลคลองท่อมใต้",
"region": "TH",
"state": "จังหวัดกระบี่",
"town": "",
"zip_code": "81120"
},
"enterprise_info": null,
"location_id": "TH1004MQZ",
"warehouse_id": 10001016,
"warehouse_name": "TH Warehouse 1",
"warehouse_region": "TH",
"warehouse_type": 1
},
{
"address": {
"address": "11",
"address_name": "Alchomyaceae",
"city": "Metro Manila",
"district": "Santa Cruz",
"region": "PH",
"state": "Metro Manila",
"town": "Barangay 297",
"zip_code": "1003"
},
"enterprise_info": null,
"location_id": "PH1003UYZ",
"warehouse_id": 10001015,
"warehouse_name": "PH Warehouse 1",
"warehouse_region": "PH",
"warehouse_type": 1
},
{
"address": {
"address": "11",
"address_name": "Dũng Nguyễn",
"city": "Thành Phố Thủ Đức",
"district": "Phường An Khánh",
"region": "VN",
"state": "TP. Hồ Chí Minh",
"town": "",
"zip_code": ""
},
"enterprise_info": null,
"location_id": "VN1002BGZ",
"warehouse_id": 10001014,
"warehouse_name": "VN Warehouse 1",
"warehouse_region": "VN",
"warehouse_type": 1
},
{
"address": {
"address": "台北市大同區民生西路63號",
"address_name": "Sal Tori",
"city": "大同區",
"district": "",
"region": "TW",
"state": "臺北市",
"town": "",
"zip_code": "103"
},
"enterprise_info": null,
"location_id": "TW10066AZ",
"warehouse_id": 10001013,
"warehouse_name": "TW Warehouse 1",
"warehouse_region": "TW",
"warehouse_type": 1
},
{
"address": {
"address": "32 Tras St, CLUB HIROSHIMA, Singapore 078972, #1",
"address_name": "Alois Ospelt",
"city": "",
"district": "",
"region": "SG",
"state": "",
"town": "",
"zip_code": "078972"
},
"enterprise_info": null,
"location_id": "SG10066CZ",
"warehouse_id": 10001012,
"warehouse_name": "SG Warehouse 1",
"warehouse_region": "SG",
"warehouse_type": 1
}
]
}
}
§14 Error example
Error example
§15 JSON
JSON
{
"error": "error_param",
"message": "warehouse_type: warehouse_type must be one of the following: 1, 2",
"request_id": "7f56a3913bb0f7d9a8a666de836ca6ca",
"response": null
}
§16 Errors
Errors
| Error | Description | Solution |
|---|---|---|
| error_data | parse data failed | |
| error_data | data not exist | |
| error_param | parameter invalid | |
| error_param | The information you queried is not found. | |
| error_param | Wrong parameters, detail: {msg}. | |
| error_server | Something wrong. Please try later. | |
| error_param | request not from gateway |
§17 Common errors
Common errors
| Error | Description | Solution |
|---|---|---|
| error_auth | partner_id is invalid | |
| error_auth | The App is deleted, and you'll be unable to make any API call. | |
| error_auth | App developer’s permissions for authorizations have been restricted. If you’re a seller, contact the developer for more information. If you’re the developer, refer to the Open Platform Console for details. | |
| error_param | There is no partner_id in query. | |
| error_param | Invalid partner_id. | |
| error_param | no timestamp | |
| error_param | Invalid timestamp | |
| error_param | There is no sign in query. | |
| error_sign | Wrong sign. | |
| invalid_partner_id | Invalid partner_id, please have a check. | |
| error_auth | No permission to current api. | |
| error_api_call_restricted | The App permission for api call have been restricted. If you’re a seller, contact the developer for more information. If you’re the developer, refer to the Open Platform Console for details. | |
| api_suspended | The API is offline. Please call v2 API instead. | |
| error_limit | The total API call number made by your APP has reached the daily API call limit, please try again after 00: 00 (UTC+08:00) | |
| error_rate_limit | Too many requests. You have reached the rate limit. Please try again later. | |
| source_ip_undeclared | Request Source IP ({ip}) is undeclared. Please declare all your IP addresses in the Shopee Open Platform Console > App list > IP Address Whitelist | |
| error_param | Permission denied. This API is currently offline or the request path is incorrect. | |
| error_param | Partner_id is invalid, should be an integer between 0 and 4294967295. | |
| error_param | no timestamp. | |
| error_param | Timestamp is invalid, should be an integer between 0 and 4294967295. | |
| error_param | Timestamp is expired. | |
| error_partner_key_expired | Your API partner key has expired, please reset the Live API Partner Key in Console to get a new valid partner key to call open api. | |
| error_api_permission | This app type has no permission to this API. | |
| error_param | There is no access_token in query. | |
| error_auth | Invalid access_token. | |
| merchant_no_linked | Partner and merchant has no linked. | |
| invalid_acceess_token | Invalid access_token, please have a check. | |
| partner_frozen | The Partner has been frozen. Permissions for merchant authorization and API calls have been suspended until permissions are restored. | |
| error_param | There is no merchant_id in query. | |
| error_param | merchant_id is invalid, should be an integer between 0 and 4294967295. |
§18 Update log
Update log
| Date | Change |
|---|---|
| 2023-12-14 | New API |
