# 创建订单
接口地址: http://www.damaijia168.com/vv/external/v1/order_create
请求方式: POST
传参方式: JSON
返回格式: JSON
# 请求头参数
| 参数 | 类型 | 必选 | 值 | 示例 |
|---|---|---|---|---|
| Authorization | string | 是 | 授权 access_token | 1798c6aadec33d1bc2f5b707f1049aefexxxx |
# 请求参数
| 参数 | 类型 | 必选 | 描述 |
|---|---|---|---|
| product_id | int | 是 | 礼品ID |
| site_order_id | int | 否 | 自定义订单ID(不填写统默认返回自定义包裹id) |
| product_number | int | 是 | 下单数量 |
| remark | string | 是 | 备注 |
| consignees | array | 是 | 收货人信息 |
| —site_order_consignee_id | int | 否 | 自定义包裹id(不填写统默认返回自定义包裹id) |
| —consignee | string | 是 | 收货人 |
| —mobile | string | 是 | 手机号 |
| —province | string | 是 | 省份 |
| —city | string | 是 | 市 |
| —district | string | 是 | 区 |
| —address | string | 是 | 具体地址 |
| —platform_order_sn | string | 是 | 第三方平台订单号:淘、猫、京、拼等平台订单编号,如无订单编号可随机填写 |
| source | string | 是 | 来源 taobao:淘宝 tmall:天猫 jd:京东 pdd:拼多多 other:其他 |
| consigners | array | 否 | 发货人信息 |
| —consigner | string | 否 | 发货人 |
| —mobile | string | 否 | 手机号 |
| —province | string | 否 | 省份 |
| —city | string | 否 | 市 |
| —district | string | 否 | 区 |
| —address | string | 否 | 具体地址 |
# 请求示例
{
"product_id":614,
"site_order_id":1000111,
"product_number": 1,
"remark": "ceshi",
"source": "taobao",
"consignees": [
{
"site_order_consignee_id": "1000111",
"consignee": "测试",
"mobile": "1556****887",
"province": "浙江省",
"city": "**市",
"district": "**区",
"address": "****108号",
"platform_order_sn": "000********"
}
]
}
# 请求代码示例
cURL请求代码示例
curl --location --request POST 'http://www.damaijia168.com/vv/external/v1/order_create' \--header 'Authorization: 4703691108576a896499ddxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"product_id":614,
"site_order_id":1000111,
"product_number": 1,
"remark": "ceshi",
"source": "taobao",
"consignees": [
{
"site_order_consignee_id": "1000111",
"consignee": "测试",
"mobile": "15*********7",
"province": "浙江省",
"city": "杭州市",
"district": "余杭区",
"address": "梦想大道108号",
"platform_order_sn": "00000000001"
}
]
}'
PHP请求代码示例
<?php
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'http://www.damaijia168.com/vv/external/v1/order_create', 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 =>'{
"product_id":614,
"site_order_id":1000111,
"product_number": 1,
"remark": "ceshi",
"source": "taobao",
"consignees": [
{
"site_order_consignee_id": "1000111",
"consignee": "测试",
"mobile": "15*********7",
"province": "浙江省",
"city": "杭州市",
"district": "余杭区",
"address": "梦想大道108号",
"platform_order_sn": "00000000001"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Authorization: 4703691108576a896499dxxxxxxx',
'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 \"product_id\":614,\r\n \"site_order_id\":1000111,\r\n \"product_number\": 1,\r\n \"remark\": \"ceshi\",\r\n \"source\": \"taobao\",\r\n \"consignees\": [\r\n {\r\n \"site_order_consignee_id\": \"1000111\",\r\n \"consignee\": \"测试\",\r\n \"mobile\": \"15*********7\",\r\n \"province\": \"浙江省\",\r\n \"city\": \"杭州市\",\r\n \"district\": \"余杭区\",\r\n \"address\": \"梦想大道108号\",\r\n \"platform_order_sn\": \"00000000001\"\r\n }\r\n ]\r\n}");
Request request = new Request.Builder()
.url("http://www.damaijia168.com/vv/external/v1/order_create")
.method("POST", body)
.addHeader("Authorization", "4703691108576a896499ddaxxxxxxxxx")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Python请求代码示例
import requests
import json
url = "http://www.damaijia168.com/vv/external/v1/order_create"
headers = {
'Authorization': '1798c6aadec33d1bc2f5b707f1049aefexxxx',
'Content-Type': 'application/json'
}
payload = json.dumps({
"product_id":614,
"site_order_id":1000111,
"product_number": 1,
"remark": "ceshi",
"source": "taobao",
"consignees": [
{
"site_order_consignee_id": "1000111",
"consignee": "测试",
"mobile": "15*********7",
"province": "浙江省",
"city": "杭州市",
"district": "余杭区",
"address": "梦想大道108号",
"platform_order_sn": "00000000001"
}
]
})
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
# 响应参数
| 参数 | 类型 | 描述 |
|---|---|---|
| data | object | 执行任务 |
| order_id | int | 订单id |
| order_sn | string | 订单编号 |
| consignees | array | 收货人信息 |
| –site_order_consignee_id | int | 自定义包裹id |
| –forbidden_zone | string | 禁发区名 |
| –msg_code | string | 错误码, 2000 成功 2001 发货地已禁发 |
| –msg | string | 返回信息 |
| -amount | int | 消耗点券(点券) |
| status | int | 状态码,0为成功 |
# 返回数据
{
"data": {
"order_id": 360,
"order_sn": "2021020411023208680132",
"consignees": [
{
"site_order_consignee_id": "88888111",
"forbidden_zone": "北京/北京市",
"msg_code": 2001,
"msg": "该地区已禁发"
},
{
"site_order_consignee_id": "77788111",
"forbidden_zone": "北京/北京市",
"msg_code": 2000,
"msg": ""
}
]
},
"status": 0
}
# 错误码(更多错误码请进入获取token页面查看公共错误码)
| 状态码(status)) | 错误说明 |
|---|---|
| 132 | 请求格式必须为JSON |
| 422 | 参数列表不合法,在err中会给出提示 |
| 200 | 认证失败 |
| 209 | 账户余额不足 |
| 234 | site_order_id已存在 |
| 226 | 商品已下架 |
| 228 | 当前商品暂不支持该发货平台 |
| 235 | 商品发货地已禁发 |
| 状态码(msg_code) | 错误说明 |
|---|---|
| 2000 | 成功 |
| 2001 | 发货地已禁发 |