General #
The MP APIs system currently only shows support for functions such as orders, traffic, and alarms
API Request #
API request body is comprised of parameters that are used to request information from MP platform
request header #
You do not perform access_token authentication for external apis, but perform signature verification through API gateway. For details about how to generate signatures, see Generating the signature
Across the APIs, below are the common request header and their descriptions:
Parameter name | Schema | Required | Description | Default | Example | Fixed value |
---|---|---|---|---|---|---|
X-HMAC-SIGNATURE | string | true | Indicates the signature generated by the signature algorithm specified by X-HMAC-ALGORITHM |
8XV1GB7Tq23OJcoz6wjqTs4ZLxr9DiLoY4PxzScWGYg= | false | |
X-HMAC-ALGORITHM | string | true | Signature algorithm | hmac-sha256 | hmac-sha256 | true |
X-HMAC-ACCESS-KEY | string | true | Client Access Key (Partner code) | SG00000010 | false | |
Date | string | false | GMT format date character string | Tue, 19 Jan 2021 11:33:20 GMT | false | |
X-HMAC-SIGNED-HEADERS | string | false | Specify the request header name to participate in signature calculation, multiple use ; separate |
Accept-Language;Content-Type | true | |
Accept-Language | string | true | i18n Internationalization identity | zh-CN | en-US | false |
Content-Type | string | true | Content type | application/json | application/json | true |
sample #
//sample code
curl -i "https://127.0.0.1:9080/index.html?name=james&age=36" \
-H "X-HMAC-SIGNATURE: 8XV1GB7Tq23OJcoz6wjqTs4ZLxr9DiLoY4PxzScWGYg=" \
-H "X-HMAC-ALGORITHM: hmac-sha256" \
-H "X-HMAC-ACCESS-KEY: user-key" \
-H "Date: Tue, 19 Jan 2021 11:33:20 GMT" \
-H "X-HMAC-SIGNED-HEADERS:Accept-Language;Content-Type" \
-H "Accept-Language:en-US" \
-H "Content-Type:application/json"
API Response #
Reponse usually follows below format:
{
"code": 200,
"msg": "string",
"data": {}
}
Name | Schema | Description |
---|---|---|
code | int | Response code. 200 means success |
msg | string | Response msg. |
data | json or null | Response data. |
Response verification signature #
The request header of Response returns the necessary parameters for signature calculation. For specific steps, refer to:
Response verification signature
Response code #
HTTP code #
Code | Description |
---|---|
200 | Success |
401 | Authentication failure |
403 | Deny access |
404 | Not found |
Business code #
Code | Description |
---|---|
500 | Service Exception |
60001 | Parameter missing |
60002 | Illegal parameter |
60003 | Data does not exist |
60004 | Data already exists |