每次调用接口时,可能获得正确或错误的返回码,使用者可以根据返回码信息调试接口,排查错误,为了更加规范服务器的返回信息,增加使用者的可读性和接口可用性,除数据特定返回内容外增加了全局的返回码
标准返回格式如:
{
"code": 10000,
"msg": "success",
"data": {
"ware_id": 888888888
}
}
code为返回码,msg为返回码调用状态说明,data为返回数据.其中code=10000为调用成功并返回成功状态或数据.其他为调用失败返回错误返回码和调用状态说明,由于开放平台数据来源多样性,设计了如下状态码拆解:
全局码 | 说明 |
10000 | 成功 |
10204 | 系统级错误(02号数据源04号错误) |
20503 | 应用级错误(05号数据源03号错误) |
-1 | 访问未成功 |
开放平台返回码
全局码 | 说明 |
10000 | 成功 |
-1 | 访问未成功 |
10001 | 回调地址未认证 |
10002 | 身份令牌验证失败 |
10003 | 没有权限访问 |
10004 | 身份令牌过期 |
10005 | 当日超过最大次数 |
商品库返回码
全局码 | 说明 |
10000 | 成功 |
-1 | 访问未成功 |
20300 | lack of param |
20301 | api not found |
20302 | api version not found |
20303 | server internal error |
20304 | this api only supports post method |
20310 | mall_id you have input not exists |
20320 | saving ware failed |
20321 | ware you have input already exists |
20322 | ware you have input not exists |
20323 | ware-owner relation not matches |
20324 | insert ware failed |
20325 | illegal param |
20326 | saving comment failed |
20327 | enqueuing ware info failed |