# 获取token
# 如何使用
下单流程:
1,通过app_id和app_secret获取access_token
2,其他请求请求头全部加入Authorization: ******************************(access_token)
比如:Authorization: 5d34d5197d131ae0dae4a63d219516b1xxxxxxxx
3,获取快递列表,从中取出仓库id
4,通过仓库id,获取该仓库下的商品列表
5,通过商品id创建订单(该接口会返回订单号,可以通过此订单号进行取消发货和订单查询)
接口地址: http://www.damaijia168.com/vv/external/user_login
请求方式: POST
传参方式: JSON
返回格式: JSON
# 请求头参数
| 参数 | 类型 | 必选 | 描述 |
|---|---|---|---|
| app_id | int | 是 | app_ID |
| app_secret | int | 是 | app_secret |
###请求示例
{
"app_id":"f823239df5e1059396431415e7xxxxxx",
"app_secret":"23ee22eaba297944c96afdbe5b1xxxxxx"
}
# 请求代码示例
cURL请求代码示例
curl --location --request POST 'http://www.damaijia168.com/vv/external/user_login' \--header 'Content-Type: application/json' \
--data-raw '{
"app_id":"f823239df5e1059396431415e7xxxxxx",
"app_secret":"23ee22eaba297944c96afdbe5b1xxxxxx"
}'
PHP请求代码示例
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://www.damaijia168.com/vv/external/user_login",
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 =>"{\r\n \"app_id\":\"f823239df5e1059396431415e7xxxxxx\",\r\n \"app_secret\":\"23ee22eaba297944c96afdbe5b1xxxxxx\"\r\n\r\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
JAVA请求代码示例
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"app_id\":\"f823239df5e1059396431415e7xxxxxx\",\r\n \"app_secret\":\"23ee22eaba297944c96afdbe5b1xxxxxx\"\r\n\r\n}");
Request request = new Request.Builder()
.url("http://www.damaijia168.com/vv/external/user_login")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Python请求代码示例
import requests
import json
url = "http://www.damaijia168.com/vv/external/user_login"
headers = {
'Content-Type': 'application/json'
}
payload = json.dumps({
"app_id":"f823239df5e1059396431415e7xxxxxx",
"app_secret":"23ee22eaba297944c96afdbe5b1xxxxxx"
})
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
# 响应参数
| 参数 | 类型 | 描述 |
|---|---|---|
| data | object | 返回数据 |
| ---access_token | string | 您获取到的access_token |
| status | int | 状态码,0为成功 |
# 返回数据
{
"data": {
"access_token": "14aea231f8e162649635f46b33xxxxxx"
},
"status": 0
}
# 公共错误码
| 状态码 | 错误说明 |
|---|---|
| 0 | 操作成功 |
| 132 | 请求格式必须为JSON |
| 160 | 您的请求太过频繁,请稍后再试 |
| 161 | 今天请求次数已达到上限,请明天再试 |
| 200 | 认证失败,Authorization填写错误 |
| 208 | 取消订单失败,请联系客服 |
| 209 | 账户余额不足,请先充值 |
| 213 | 包裹已发货,无法取消 |
| 226 | 商品已下架,请联系客服 |
| 227 | 仓库已下架,请联系客服 |
| 228 | 当前商品暂不支持该发货平台,换个发货平台 |
| 233 | 商品发货地异常,请联系客服 |
| 234 | site_order_id已存在 |
| 235 | 商品发货地已禁发 |
| 422 | 参数列表不合法,在err中会给出提示 |