有赞云网关官方域名:https://open.youzanyun.com
有赞云access_token获取地址:https://open.youzanyun.com/auth/token
有赞云api请求地址:https://open.youzanyun.com/api
一个API主要由api名称、api版本、鉴权方式、请求方法、请求参数和返回参数组成;
下面举个例子来说明,用接口youzan.logistics.expressbyorderno.get.3.0.0来说明一下
API名称(name) | youzan.logistics.expressbyorderno.get |
---|---|
版本(version) | 3.0.0 |
鉴权方式 | access_token |
请求方法(method) | POST |
请求参数 | tid (string) |
返回参数 | {"code":"int","data":{"com":"string","created_time":"date","express_id":"int", "data":"string","nu":"string","name":"string","id":"long","state":"int", "message":"string","status":"string"},"success":"boolean","message":"string"} |
参数 | 描述 |
---|---|
clientId | clientId |
clientSecret | clientSecret |
grantId | 授权主体Id |
redirectUri | 授权回调地址 |
code | 授权码 |
name | API名称 |
version | API版本 |
access_token | API请求access_token |
所有 Api 调用采用统一协议 Https 进行传输
请求采用 post + json 的模式
请求 access_token 放url请求参数里,接口的请求参数放请求的 body 里
Content-Type:application/json
请求地址:https://open.youzanyun.com/auth/token
Tips:请注意一定要使用POST+application/json请求方式否则会报错。
名称 | 类型 | 是否必须 | 示例值 | 描述 |
---|---|---|---|---|
client_id | String | 是 | Test client | 有赞云颁发给开发者的应用ID |
client_secret | String | 是 | Testclientsecret | 有赞云颁发给开发者的应用secret |
authorize_type | String | 是 | silent | 授与方式(固定为 “silent”) |
grant_id | String | 是 | 123456 | 授权店铺id(即kdt_id),API接口对接传店铺id,支付商户对接传mchId |
refresh | Boolean | 是 | false | 是否刷新,该参数默认为“false” |
curl -X POST https://open.youzanyun.com/auth/token -H 'content-type: application/json' -d '{"client_id": "testid","client_secret": "testsecret","authorize_type": "silent", "grant_id": "88888","refresh":"true"}'
copy
名称 | 类型 | 描述 |
---|---|---|
success | boolean | 是否成功获取 token |
code | Integer | 成功固定为:200,错误码不同 |
data | String | token 信息 |
message | String | 出现异常时,返回错误信息 |
名称 | 类型 | 描述 |
---|---|---|
access_token | String | 用于调用 API 的 access_token,有效7天 |
expires | Number | access_token 的过期时间,时间戳(单位:毫秒;过期时间:7天) |
scope | String | access_token 最终的访问范围 |
authority_id | String | 授权主体id,即店铺id |
refresh_token | String | 用于刷新access_token的刷新令牌(过期时间:28天) 提示: 若因网络等因素没有成功获取到新的access_token和refresh_token,在1个小时内仍可重新获取,多次重复调用拿到的是同一个access_token和refresh_token;而当新的refresh_token刷新时,上一个refresh_token立即失效 |
{
"success": true,
"code": 200,
"data": {
"expires": 1583720718116,
"scope": "beauty_appointment beauty_cashier beauty_item beauty_member beauty_order beauty_shop beauty_staff beauty_stock buyer_bill circle coupon coupon_advanced crm_advanced cross_boarder customer extension_analysis item item_category item_hotel item_standard ka_customization level_membership logistics mei_promoter multi_store open_market open_robot pay-customs-declaration pay_qrcode points retail-scrm retail_goods retail_product retail_shop retail_stock retail_supplier retail_trade reviews salesman selffetchcode seller_refund shop storage stored_value_card tag tags trade trade-delivery trade_advanced trade_virtual user virtualticket",
"access_token": "774ae7b675f8db2aa65d38bf5de710b",
"authority_id": "42587152",
"refresh_token": "93fdf9ffac4cba63a7044b64d5w9603"
},
"message": null
}
copy