# 云打印
接口地址: http://www.damaijia168.com/vv/external/waybill
请求方式: POST
传参方式: JSON
返回格式: JSON
# 请求头参数
| 参数 | 类型 | 必选 | 值 | 示例 |
|---|---|---|---|---|
| Authorization | string | 是 | 授权 access_token | 1798c6aadec33d1bc2f5b707f1049aefexxxx |
# 请求参数
| 名称 | 类型 | 必须 | 示例值 | 描述 |
|---|---|---|---|---|
| shop_id | String | true | 12345 | 店铺ID |
| params | object | true | 入参信息 | |
| param_waybill _cloud_print_apply_new_request | WaybillCloudPrintApplyNewRequest | true | 入参信息 | |
| cp_code | String | true | POSTB | 物流公司Code,长度小于20 |
| product_code | String | false | 目前已经不推荐使用此字段,请不要使用 | 目前已经不推荐使用此字段,请不要使用 |
| sender | UserInfoDto | true | 发货人信息 | |
| address | AddressDto | true | 发货地址需要通过search接口 | |
| city | String | false | 北京市 | 城市,长度小于20 |
| detail | String | true | 花家地社区卫生服务站 | 详细地址,长度小于256 |
| district | String | false | 朝阳区 | 区,长度小于20 |
| province | String | true | 北京 | 省,长度小于20 |
| town | String | false | 望京街道 | 街道,长度小于30 |
| mobile | String | false | 1326443654 | 手机号码(手机号和固定电话不能同时为空),长度小于20 |
| name | String | true | Bar | 姓名,长度小于40 |
| phone | String | false | 057123222 | 固定电话(手机号和固定电话不能同时为空),长度小于20 |
| trade_order_info_dtos | TradeOrderInfoDto[] | true | 请求面单信息,数量限制为10 | |
| logistics_services | String | false | 如不需要特殊服务,该值为空 | 物流服务值(详见https://support-cnkuaidi.taobao.com/doc.htm#?docId=106156&docType=1,如无特殊服务请置空) |
| object_id | String | true | 1 | 请求ID |
| order_info | OrderInfoDto | true | 订单信息 | |
| order_channels_type | String | true | TB | 订单渠道平台编码 |
| trade_order_list | String[] | true | 1222221 | 订单号,数量限制100,订单号(只限传入数字、字母、下划线和中划线,为避免出现冲突,请按电商平台真实订单号传入,请避免使用同个订单号重复取号) |
| out_trade_order_list | String[] | false | 123456,456789 | 外部电商平台交易单号集合,非必填,数量限制100 |
| out_trade_sub_order_list | String[] | false | 12,34,56,78 | 外部电商平台交易子单号集合,非必填,数量限制100 |
| package_info | PackageInfoDto | true | 包裹信息 | |
| id | String | false | 1 | 包裹id,用于拆合单场景(只能传入数字、字母和下划线;批量请求时值不得重复,大小写敏感,即123A,123a 不可当做不同ID,否则存在一定可能取号失败) |
| items | Item[] | true | 商品信息,数量限制为100 | |
| count | Number | true | 1 | 数量 |
| name | String | true | 衣服 | 名称 |
| volume | Number | false | 1 | 体积, 单位 ml |
| weight | Number | false | 1 | 重量,单位 g |
| total_packages_count | Number | false | 10 | 子母件模式中的总包裹数/总件数,用于打印当前包裹处于总件数的位置比如5-2,可以表示总包裹数为5,当前为第2个包裹,只有快运公司需要传入,其他的可以不用传入 |
| packaging_description | String | false | 5纸3木2拖 | 大件快运中的包装方式描述 |
| goods_description | String | false | 服装 | 大件快运中的货品描述,比如服装,家具 |
| recipient | RecipientInfoDto | true | 收件人信息 | |
| address | AddressDto | true | 地址 | |
| city | String | false | 北京市 | 城市 |
| detail | String | true | 花家地社区卫生服务站 | 详细地址 |
| district | String | false | 朝阳区 | 区 |
| province | String | true | 北京 | 省 |
| town | String | false | 望京街道 | 街道 |
| mobile | String | false | 1326443654 | 手机号码 |
| name | String | true | Bar | 姓名 |
| phone | String | false | 057123222 | 固定电话 |
| oaid | String | false | abcdefghijk | 淘宝订单收件人ID (Open Addressee ID),长度不超过128个字符,淘宝订单加密情况用于解密。 |
| tid | String | false | 1527014522198024829 | 电商平台真实交易订单号,针对电商平台订单隐私加密场景使用,非必填,如果填写则必须是电商平台真实的交易订单ID |
| caid | String | false | As268woscee | 菜鸟解密地址ID,用于电商平台收件人信息加密的场景使用,非订单加密场景请勿使用。 |
| template_url | String | true | http://cloudprint.cainiao.com/template/standard/101 | 云打印标准模板URL(组装云打印结果使用,值格式http://cloudprint.cainiao.com/template/standard/${模板ID}) |
| user_id | Number | true | 12 | 使用者ID(使用电子面单账号的实际商家ID,如存在一个电子面单账号多个店铺使用时,请传入店铺的商家ID) |
| store_code | String | false | 553323 | 仓code, 仓库WMS系统对接落地配业务,其它场景请不要使用 |
| resource_code | String | false | DISTRIBUTOR_978324 | 配送资源code, 仓库WMS系统对接落地配业务,其它场景请不要使用 |
| dms_sorting | Boolean | false | false | 是否使用智分宝预分拣, 仓库WMS系统对接落地配业务,其它场景请不要使用 |
| three_pl_timing | Boolean | false | false | 订单上是否带3PLtiming属性, 该属性需要严格与订单上属性保持一致,如果不确定,请使用默认false。 |
| need_encrypt | Boolean | false | false | 设定取号返回的云打印报文是否加密 |
| multi_packages_shipment | Boolean | 否 | false | 快递公司支持一票多件,快运公司子母件请勿使用该参数 |
| brand_code | String | 否 | FOP | 品牌编码 |
| extra_info | String | 否 | 扩展参数 | |
| customer_code | String | 否 | adb123345 | 月结卡号 |
| call_door_pick_up | Boolean | 否 | false | 是否预约上门 |
| door_pick_up_time | String | 否 | 2021-08-07 12:34:30 | 预约上门收件时间 |
| door_pick_up_end_time | String | 否 | 2021-08-07 12:34:30 | 预约上门截止时间 |
| shipping_branch_code | String | 否 | 10001 | 寄件网点编码 |
| edition | string | 否 | 版本 默认:1(不传默认为1) 1:1.0,2:2.0 |
# 请求示例
{
"edition": "1",
"shop_id": "1234",
"params":{
"param_waybill_cloud_print_apply_new_request": {
"brand_code": "FOP",
"cp_code": "SF",
"sender": {
"address": {
"province": "浙江省",
"city": "杭州市",
"district": "大山区",
"detail": "太阳边上"
},
"mobile": "4214213213213",
"name": "郭X"
},
"trade_order_info_dtos": [
{
"object_id": "1",
"order_info": {
"order_channels_type": "TB",
"trade_order_list": [
"111111111111111111111111"
]
},
"package_info": {
"items": [
{
"count": "1",
"name": "其它-百货"
}
],
"goods_description":"服装",
"length":"30",
"width":"30",
"height":"30"
},
"recipient": {
"address": {
"detail": "宝**街道**小区",
"province": "浙江省"
},
"mobile": "*******9213",
"name": "森*",
"oaid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"template_url": "https://cloudprint.cainiao.com/template/standard/471314/19",
"user_id": 123
}
]
}
}
}
# 请求代码示例
cURL请求代码示例
curl --location --request POST 'http://test.damaijia168.com/vv/external/waybill' \
--header 'Authorization: 88b8733a4cad30e445277167d0e7ee77' \
--header 'Content-Type: application/json' \
--data-raw '{
"edition": "1",
"shop_id": "1234",
"params":{
"param_waybill_cloud_print_apply_new_request": {
"brand_code": "FOP",
"cp_code": "SF",
"sender": {
"address": {
"province": "浙江省",
"city": "杭州市",
"district": "大山区",
"detail": "太阳边上"
},
"mobile": "4214213213213",
"name": "郭X"
},
"trade_order_info_dtos": [
{
"object_id": "1",
"order_info": {
"order_channels_type": "TB",
"trade_order_list": [
"111111111111111111111111"
]
},
"package_info": {
"items": [
{
"count": "1",
"name": "其它-百货"
}
],
"goods_description":"服装",
"length":"30",
"width":"30",
"height":"30"
},
"recipient": {
"address": {
"detail": "宝**街道**小区",
"province": "浙江省"
},
"mobile": "*******9213",
"name": "森*",
"oaid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"template_url": "https://cloudprint.cainiao.com/template/standard/471314/19",
"user_id": 123
}
]
}
}
}'
PHP请求代码示例
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://test.damaijia168.com/vv/external/waybill',
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 =>'{
"edition": "1",
"shop_id": "1234",
"params":{
"param_waybill_cloud_print_apply_new_request": {
"brand_code": "FOP",
"cp_code": "SF",
"sender": {
"address": {
"province": "浙江省",
"city": "杭州市",
"district": "大山区",
"detail": "太阳边上"
},
"mobile": "4214213213213",
"name": "郭X"
},
"trade_order_info_dtos": [
{
"object_id": "1",
"order_info": {
"order_channels_type": "TB",
"trade_order_list": [
"111111111111111111111111"
]
},
"package_info": {
"items": [
{
"count": "1",
"name": "其它-百货"
}
],
"goods_description":"服装",
"length":"30",
"width":"30",
"height":"30"
},
"recipient": {
"address": {
"detail": "宝**街道**小区",
"province": "浙江省"
},
"mobile": "*******9213",
"name": "森*",
"oaid": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"template_url": "https://cloudprint.cainiao.com/template/standard/471314/19",
"user_id": 123
}
]
}
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: 88b8733a4cad30e445277167d0e7ee77',
'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 \"edition\": \"1\",\r\n \"shop_id\": \"1234\",\r\n \"params\":{\r\n \"param_waybill_cloud_print_apply_new_request\": {\r\n \"brand_code\": \"FOP\",\r\n \"cp_code\": \"SF\",\r\n \"sender\": {\r\n\t\t\t\t\"address\": {\r\n\t\t\t\t\t\"province\": \"浙江省\",\r\n\t\t\t\t\t\"city\": \"杭州市\",\r\n\t\t\t\t\t\"district\": \"大山区\",\r\n\t\t\t\t\t\"detail\": \"太阳边上\"\r\n\t\t\t\t},\r\n\t\t\t\t\"mobile\": \"4214213213213\",\r\n\t\t\t\t\"name\": \"郭X\"\r\n },\r\n \"trade_order_info_dtos\": [\r\n {\r\n \"object_id\": \"1\",\r\n \"order_info\": {\r\n \"order_channels_type\": \"TB\",\r\n \"trade_order_list\": [\r\n \"111111111111111111111111\"\r\n ]\r\n },\r\n \"package_info\": {\r\n \"items\": [\r\n {\r\n \"count\": \"1\",\r\n \"name\": \"其它-百货\"\r\n }\r\n ],\r\n \"goods_description\":\"服装\",\r\n \"length\":\"30\",\r\n \"width\":\"30\",\r\n \"height\":\"30\"\r\n \r\n },\r\n \"recipient\": {\r\n \"address\": {\r\n \"detail\": \"宝**街道**小区\",\r\n \"province\": \"浙江省\"\r\n },\r\n \"mobile\": \"*******9213\",\r\n \"name\": \"森*\",\r\n \"oaid\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\r\n },\r\n \"template_url\": \"https://cloudprint.cainiao.com/template/standard/471314/19\",\r\n \"user_id\": 123\r\n }\r\n ]\r\n }\r\n }\r\n}");
Request request = new Request.Builder()
.url("http://test.damaijia168.com/vv/external/waybill")
.method("POST", body)
.addHeader("Authorization", "88b8733a4cad30e445277167d0e7ee77")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Pyton请求代码示例
import requests
url = "http://test.damaijia168.com/vv/external/waybill"
payload="{\r\n \"edition\": \"1\",\r\n \"shop_id\": \"1234\",\r\n \"params\":{\r\n \"param_waybill_cloud_print_apply_new_request\": {\r\n \"brand_code\": \"FOP\",\r\n \"cp_code\": \"SF\",\r\n \"sender\": {\r\n\t\t\t\t\"address\": {\r\n\t\t\t\t\t\"province\": \"浙江省\",\r\n\t\t\t\t\t\"city\": \"杭州市\",\r\n\t\t\t\t\t\"district\": \"大山区\",\r\n\t\t\t\t\t\"detail\": \"太阳边上\"\r\n\t\t\t\t},\r\n\t\t\t\t\"mobile\": \"4214213213213\",\r\n\t\t\t\t\"name\": \"郭X\"\r\n },\r\n \"trade_order_info_dtos\": [\r\n {\r\n \"object_id\": \"1\",\r\n \"order_info\": {\r\n \"order_channels_type\": \"TB\",\r\n \"trade_order_list\": [\r\n \"111111111111111111111111\"\r\n ]\r\n },\r\n \"package_info\": {\r\n \"items\": [\r\n {\r\n \"count\": \"1\",\r\n \"name\": \"其它-百货\"\r\n }\r\n ],\r\n \"goods_description\":\"服装\",\r\n \"length\":\"30\",\r\n \"width\":\"30\",\r\n \"height\":\"30\"\r\n \r\n },\r\n \"recipient\": {\r\n \"address\": {\r\n \"detail\": \"宝**街道**小区\",\r\n \"province\": \"浙江省\"\r\n },\r\n \"mobile\": \"*******9213\",\r\n \"name\": \"森*\",\r\n \"oaid\": \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\r\n },\r\n \"template_url\": \"https://cloudprint.cainiao.com/template/standard/471314/19\",\r\n \"user_id\": 123\r\n }\r\n ]\r\n }\r\n }\r\n}"
headers = {
'Authorization': '88b8733a4cad30e445277167d0e7ee77',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
# 响应参数
| 参数 | 类型 | 描述 |
|---|---|---|
| data | object | 返回数据 |
| --modules | WaybillCloudPrintResponse [] | 系统自动生成 |
| --object_id | String | 请求 id |
| --waybill_code | String | 面单号, 子母件模式下为子面单号 |
| --print_data | String | 云打印内容(encryptedData 表示加密结果,data 表示非加密结果);模板内容,具体解释见链接 |
| --parent_waybill_code | String | 子母件中的母单号,当为子母件模式时,需要此单号为实际挂载物流详情的单号,需要使用此单号进行发货,查询物流详情,非子母件,此字段为空 |
| --deduct_money | int | 消耗点券 |
| status | int | 状态码,0为成功 |
# 返回数据
{
"data":{
"deduct_money": 1,
"cainiao_waybill_ii_get_response":{
"modules":{
"waybill_cloud_print_response":[
{
"object_id":"12",
"waybill_code":"9890000160004",
"print_data":"{\\\"data\\\":{\\\"recipient\\\":{\\\"address\\\":{\\\"city\\\":\\\"北京市\\\",\\\"detail\\\":\\\"花家地社区卫生服务站\\\",\\\"district\\\":\\\"朝阳区\\\",\\\"province\\\":\\\"北京\\\",\\\"town\\\":\\\"望京街道\\\"},\\\"mobile\\\":\\\"1326443654\\\",\\\"name\\\":\\\"Bar\\\",\\\"phone\\\":\\\"057123222\\\"},\\\"routingInfo\\\":{\\\"consolidation\\\":{},\\\"origin\\\":{\\\"code\\\":\\\"POSTB\\\"},\\\"sortation\\\":{\\\"name\\\":\\\"杭州\\\"}},\\\"dmsSortingInfo\\\": {\\\"siteAreaCode\\\": \\\"A2\\\"},\\\"sender\\\":{\\\"address\\\":{\\\"city\\\":\\\"北京市\\\",\\\"detail\\\":\\\"花家地社区卫生服务站\\\",\\\"district\\\":\\\"朝阳区\\\",\\\"province\\\":\\\"北京\\\",\\\"town\\\":\\\"望京街道\\\"},\\\"mobile\\\":\\\"1326443654\\\",\\\"name\\\":\\\"Bar\\\",\\\"phone\\\":\\\"057123222\\\"},\\\"shippingOption\\\":{\\\"code\\\":\\\"COD\\\",\\\"services\\\":{\\\"SVC-COD\\\":{\\\"value\\\":\\\"200\\\"}},\\\"title\\\":\\\"代收货款\\\"},\\\"waybillCode\\\":\\\"9890000160004\\\"},\\\"signature\\\":\\\"RSA:hqUkugCY2FFXJK10fRcUE0TsvDppxXuBdOEnPVntF3u4H2yaYiPsPXqjdI1C5oXs60vVCfqd8YC6vZx57TnN9\/u0VYM\/TiFmMtxix9ouPQ2p7G64UyX9BrnRQQCp5ETqJogSzIpxVlz5rx3hy19C+VQrqWgQEw5JqOkoBFXhMi8\\u003d\\\",\\\"templateURL\\\":\\\"http:\/\/cloudprint.cainiao.com\/cloudprint\/template\/getStandardTemplate.json?template_id\\u003d1001\\\"}",
"parent_waybill_code":"9890000160004"
}
]
}
},
"status": 0
}
# 错误码
| 状态码(status) | 错误信息 | 解决方案 |
|---|---|---|
| 132 | 请求格式必须为JSON | 修改请求参数格式为json |
| 422 | 参数列表不合法,在err中会给出提示 | 根据提示做相应修改 |
| 200 | 认证失败 | 请确保请求头里的Authorization存在或者未过期 |