中通开放平台接口说明

SDK

你可以使用中通提供的SDK来调用,无需关注签名生成

JAVA:https://github.com/ZTO-Express/zopsdk-java

.NET:https://github.com/ZTO-Express/zopsdk-net

PHP:https://github.com/ZTO-Express/zopsdk-php

NODEJS:https://github.com/ZTO-Express/zopsdk-node

SDK目前还不完善,如有问题请直接在github提issue

如果你想自己开发,请往下阅读,代码可参考左侧"多种语言示例"

Content-Type

中通目前所有接口只支持application/x-www-form-urlencoded的方式调用

字符集编码

中通所有接口均只支持UTF-8编码

请求方法

中通接口只支持POST

请求头

Content-Type: application/x-www-form-urlencoded

还需要在请求头中添加以下两个参数

x-companyid:在个人中心查看

x-datadigest:请点击这里查看

请求BODY

当content-type使用application/x-www-form-urlencoded的时候,业务参数以&分隔,键值对以=分隔,其中非字母或者非数字的字符都需要URL编码(又称百分号编码/percent encoding),以下是几个接口的示例

获取单号(有密钥)

data=%7b%22content%22%3a%7b%22branchId%22%3a%22%22%2c%22buyer%22%3a%22%22%2c%22collectMoneytype%22%3a%22CNY%22%2c%22collectSum%22%3a%2212.00%22%2c%22freight%22%3a%2210.00%22%2c%22id%22%3a%22xfs2018031500002222333%22%2c%22orderSum%22%3a%220.00%22%2c%22orderType%22%3a%221%22%2c%22otherCharges%22%3a%220.00%22%2c%22packCharges%22%3a%221.00%22%2c%22premium%22%3a%220.50%22%2c%22price%22%3a%22126.50%22%2c%22quantity%22%3a%222%22%2c%22receiver%22%3a%7b%22address%22%3a%22%e8%82%b2%e5%be%b7%e8%b7%afXXX%e5%8f%b7%22%2c%22area%22%3a%22501022%22%2c%22city%22%3a%22%e5%9b%9b%e5%b7%9d%e7%9c%81%2cXXX%2cXXXX%22%2c%22company%22%3a%22XXXX%e6%9c%89%e9%99%90%e5%85%ac%e5%8f%b8%22%2c%22email%22%3a%22yyj%40abc.com%22%2c%22id%22%3a%22130520142097%22%2c%22im%22%3a%22yangyijia-abc%22%2c%22mobile%22%3a%22136*****321%22%2c%22name%22%3a%22XXX%22%2c%22phone%22%3a%22010-222***89%22%2c%22zipCode%22%3a%22610012%22%7d%2c%22remark%22%3a%22%e8%af%b7%e5%8b%bf%e6%91%94%e8%b4%a7%22%2c%22seller%22%3a%22%22%2c%22sender%22%3a%7b%22address%22%3a%22%e5%8d%8e%e6%96%b0%e9%95%87%e5%8d%8e%e5%bf%97%e8%b7%afXXX%e5%8f%b7%22%2c%22area%22%3a%22310118%22%2c%22city%22%3a%22%e4%b8%8a%e6%b5%b7%2c%e4%b8%8a%e6%b5%b7%e5%b8%82%2c%e9%9d%92%e6%b5%a6%e5%8c%ba%22%2c%22company%22%3a%22XXXXX%e6%9c%89%e9%99%90%e5%85%ac%e5%8f%b8%22%2c%22email%22%3a%22ll%40abc.com%22%2c%22endTime%22%3a1369033200000%2c%22id%22%3a%22131*****010%22%2c%22im%22%3a%221924656234%22%2c%22mobile%22%3a%221391***5678%22%2c%22name%22%3a%22XXX%22%2c%22phone%22%3a%22021-87***321%22%2c%22startTime%22%3a1369022400000%2c%22zipCode%22%3a%22610012%22%7d%2c%22size%22%3a%2212%2c23%2c11%22%2c%22tradeId%22%3a%222701843%22%2c%22type%22%3a%221%22%2c%22typeId%22%3a%22%22%2c%22weight%22%3a%220.753%22%7d%2c%22datetime%22%3a%222018-3-30+12%3a00%3a00%22%2c%22partner%22%3a%22test%22%2c%22verify%22%3a%22ZTO123%22%7d

获取单号(无密钥)

company_id=your_company_id&msg_type=submitAgent&data=%7b%22partner%22%3a%22test%22%2c%22id%22%3a%22xfs101100111011%22%2c%22tradeid%22%3a%222701843%22%2c%22sender%22%3a%7b%22id%22%3a%22131*****010%22%2c%22name%22%3a%22XXX%22%2c%22company%22%3a%22XXXXX%e6%9c%89%e9%99%90%e5%85%ac%e5%8f%b8%22%2c%22mobile%22%3a%221391***5678%22%2c%22phone%22%3a%22021-87***321%22%2c%22area%22%3a%22310118%22%2c%22city%22%3a%22%e4%b8%8a%e6%b5%b7%2c%e4%b8%8a%e6%b5%b7%e5%b8%82%2c%e9%9d%92%e6%b5%a6%e5%8c%ba%22%2c%22address%22%3a%22%e5%8d%8e%e6%96%b0%e9%95%87%e5%8d%8e%e5%bf%97%e8%b7%afXXX%e5%8f%b7%22%2c%22zipcode%22%3a%22610012%22%2c%22email%22%3a%22ll%40abc.com%22%2c%22im%22%3a%221924656234%22%2c%22starttime%22%3a%222013-05-20+12%3a00%3a00%22%2c%22endtime%22%3a%222013-05-20+15%3a00%3a00%22%7d%2c%22receiver%22%3a%7b%22id%22%3a%22130520142097%22%2c%22name%22%3a%22XXX%22%2c%22company%22%3a%22XXXX%e6%9c%89%e9%99%90%e5%85%ac%e5%8f%b8%22%2c%22mobile%22%3a%22136*****321%22%2c%22phone%22%3a%22010-222***89%22%2c%22area%22%3a%22501022%22%2c%22city%22%3a%22%e5%9b%9b%e5%b7%9d%e7%9c%81%2cXXX%2cXXXX%22%2c%22address%22%3a%22%e8%82%b2%e5%be%b7%e8%b7%afXXX%e5%8f%b7%22%2c%22zipcode%22%3a%22610012%22%2c%22email%22%3a%22yyj%40abc.com%22%2c%22im%22%3a%22yangyijia-abc%22%7d%2c%22weight%22%3a%220.753%22%2c%22size%22%3a%2212%2c23%2c11%22%2c%22quantity%22%3a%222%22%2c%22price%22%3a%22126.50%22%2c%22freight%22%3a%2210.00%22%2c%22premium%22%3a%220.50%22%2c%22pack_charges%22%3a%221.00%22%2c%22other_charges%22%3a%220.00%22%2c%22order_sum%22%3a%220.00%22%2c%22collect_moneytype%22%3a%22CNY%22%2c%22collect_sum%22%3a%2212.00%22%2c%22remark%22%3a%22%e8%af%b7%e5%8b%bf%e6%91%94%e8%b4%a7%22%2c%22order_type%22%3a%221%22%7d

CURL示例

预约寄件-创建订单

Content-Type: application/x-www-form-urlencoded
x-companyid: kfpttestCode
x-datadigest: E0EU8blTRrj7am2bX7wfhw==
Postman-Token: b4a97e7f-46ed-4036-bb2f-25a1b9ad7291

orderGroup=%7B+%22partnerCode%22%3A+%22130520142013234%22%2C+%22type%22%3A+1%2C+%22tradeId%22%3A+%222701843%22%2C+%22mailNo%22%3A+%221000000000016%22%2C+%22sender%22%3A+%7B+%22id%22%3A+%22130520142010%22%2C+%22name%22%3A+%22%E6%9D%8E%E7%90%B3%22%2C+%22company%22%3A+%22%E6%96%B0%E5%8D%97%E7%94%B5%E5%AD%90%E5%95%86%E5%8A%A1%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C+%22mobile%22%3A+%2213912345678%22%2C+%22phone%22%3A+%22021-87654321%22%2C+%22prov%22%3A+%22%E4%B8%8A%E6%B5%B7%E5%B8%82%22%2C+%22city%22%3A+%22%E4%B8%8A%E6%B5%B7%E5%B8%82%22%2C+%22county%22%3A+%22%E9%9D%92%E6%B5%A6%E5%8C%BA%22%2C+%22address%22%3A+%22%E5%8D%8E%E6%96%B0%E9%95%87%E5%8D%8E%E5%BF%97%E8%B7%AF123%E5%8F%B7%22%2C+%22zipcode%22%3A+%22610012%22+%7D%2C+%22receiver%22%3A+%7B+%22id%22%3A+%22130520142097%22%2C+%22name%22%3A+%22%E6%9D%A8%E9%80%B8%E5%98%89%22%2C+%22company%22%3A+%22%E9%80%B8%E5%98%89%E5%AE%9E%E4%B8%9A%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C+%22mobile%22%3A+%2213687654321%22%2C+%22phone%22%3A+%22010-22226789%22%2C+%22prov%22%3A+%22%E5%9B%9B%E5%B7%9D%E7%9C%81%22%2C+%22city%22%3A+%22%E6%88%90%E9%83%BD%E5%B8%82%22%2C+%22county%22%3A+%22%E6%AD%A6%E4%BE%AF%E5%8C%BA%22%2C+%22address%22%3A+%22%E8%82%B2%E5%BE%B7%E8%B7%AF497%E5%8F%B7%22%2C+%22zipcode%22%3A+%22610012%22+%7D%2C+%22items%22%3A+%5B+%7B+%22id%22%3A+%221234567%22%2C+%22name%22%3A+%22%E8%BF%B7%E4%BD%A0%E9%A3%8E%E6%89%87%22%2C+%22category%22%3A+%22%E7%94%B5%E5%AD%90%E4%BA%A7%E5%93%81%22%2C+%22material%22%3A+%22%E9%87%91%E5%B1%9E%22%2C+%22size%22%3A+%2212%2C11%2C23%22%2C+%22weight%22%3A+%221%22%2C+%22unitprice%22%3A+%2279%22%2C+%22quantity%22%3A+%221%22%2C+%22remark%22%3A+%22%E9%BB%91%E8%89%B2%E5%A4%A7%E5%8F%B7%22+%7D%2C+%7B+%22name%22%3A+%22USB3.0%E9%9B%86%E7%BA%BF%E5%99%A8%22%2C+%22quantity%22%3A+%221%22%2C+%22remark%22%3A+%22%22+%7D+%5D%2C+%22starttime%22%3A+%222013-05-20+12%3A00%3A00%22%2C+%22endtime%22%3A+%222013-05-20+15%3A00%3A00%22%2C+%22weight%22%3A+753%2C+%22size%22%3A+%2212%2C23%2C11%22%2C+%22quantity%22%3A+2%2C+%22price%22%3A+12650%2C+%22freight%22%3A+1000%2C+%22premium%22%3A+50%2C+%22packCharges%22%3A+100%2C+%22otherCharges%22%3A+0%2C+%22orderSum%22%3A+0%2C+%22collectMoneytype%22%3A+%22CNY%22%2C+%22collectSum%22%3A+1200%2C+%22remark%22%3A+%22%E8%AF%B7%E5%8B%BF%E6%91%94%E8%B4%A7%22+%7D
curl -X POST \
  http://58.40.16.125:9001/OpenOrderCreate \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'x-companyid: kfpttestCode' \
  -H 'x-datadigest: E0EU8blTRrj7am2bX7wfhw==' \
  -d orderGroup=%7B%20%22partnerCode%22%3A%20%22130520142013234%22%2C%20%22type%22%3A%201%2C%20%22tradeId%22%3A%20%222701843%22%2C%20%22mailNo%22%3A%20%221000000000016%22%2C%20%22sender%22%3A%20%7B%20%22id%22%3A%20%22130520142010%22%2C%20%22name%22%3A%20%22%E6%9D%8E%E7%90%B3%22%2C%20%22company%22%3A%20%22%E6%96%B0%E5%8D%97%E7%94%B5%E5%AD%90%E5%95%86%E5%8A%A1%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%20%22mobile%22%3A%20%2213912345678%22%2C%20%22phone%22%3A%20%22021-87654321%22%2C%20%22prov%22%3A%20%22%E4%B8%8A%E6%B5%B7%E5%B8%82%22%2C%20%22city%22%3A%20%22%E4%B8%8A%E6%B5%B7%E5%B8%82%22%2C%20%22county%22%3A%20%22%E9%9D%92%E6%B5%A6%E5%8C%BA%22%2C%20%22address%22%3A%20%22%E5%8D%8E%E6%96%B0%E9%95%87%E5%8D%8E%E5%BF%97%E8%B7%AF123%E5%8F%B7%22%2C%20%22zipcode%22%3A%20%22610012%22%20%7D%2C%20%22receiver%22%3A%20%7B%20%22id%22%3A%20%22130520142097%22%2C%20%22name%22%3A%20%22%E6%9D%A8%E9%80%B8%E5%98%89%22%2C%20%22company%22%3A%20%22%E9%80%B8%E5%98%89%E5%AE%9E%E4%B8%9A%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%20%22mobile%22%3A%20%2213687654321%22%2C%20%22phone%22%3A%20%22010-22226789%22%2C%20%22prov%22%3A%20%22%E5%9B%9B%E5%B7%9D%E7%9C%81%22%2C%20%22city%22%3A%20%22%E6%88%90%E9%83%BD%E5%B8%82%22%2C%20%22county%22%3A%20%22%E6%AD%A6%E4%BE%AF%E5%8C%BA%22%2C%20%22address%22%3A%20%22%E8%82%B2%E5%BE%B7%E8%B7%AF497%E5%8F%B7%22%2C%20%22zipcode%22%3A%20%22610012%22%20%7D%2C%20%22items%22%3A%20%5B%20%7B%20%22id%22%3A%20%221234567%22%2C%20%22name%22%3A%20%22%E8%BF%B7%E4%BD%A0%E9%A3%8E%E6%89%87%22%2C%20%22category%22%3A%20%22%E7%94%B5%E5%AD%90%E4%BA%A7%E5%93%81%22%2C%20%22material%22%3A%20%22%E9%87%91%E5%B1%9E%22%2C%20%22size%22%3A%20%2212%2C11%2C23%22%2C%20%22weight%22%3A%20%221%22%2C%20%22unitprice%22%3A%20%2279%22%2C%20%22quantity%22%3A%20%221%22%2C%20%22remark%22%3A%20%22%E9%BB%91%E8%89%B2%E5%A4%A7%E5%8F%B7%22%20%7D%2C%20%7B%20%22name%22%3A%20%22USB3.0%E9%9B%86%E7%BA%BF%E5%99%A8%22%2C%20%22quantity%22%3A%20%221%22%2C%20%22remark%22%3A%20%22%22%20%7D%20%5D%2C%20%22starttime%22%3A%20%222013-05-20%2012%3A00%3A00%22%2C%20%22endtime%22%3A%20%222013-05-20%2015%3A00%3A00%22%2C%20%22weight%22%3A%20753%2C%20%22size%22%3A%20%2212%2C23%2C11%22%2C%20%22quantity%22%3A%202%2C%20%22price%22%3A%2012650%2C%20%22freight%22%3A%201000%2C%20%22premium%22%3A%2050%2C%20%22packCharges%22%3A%20100%2C%20%22otherCharges%22%3A%200%2C%20%22orderSum%22%3A%200%2C%20%22collectMoneytype%22%3A%20%22CNY%22%2C%20%22collectSum%22%3A%201200%2C%20%22remark%22%3A%20%22%E8%AF%B7%E5%8B%BF%E6%91%94%E8%B4%A7%22%20%7D

获取单号(无密钥)

Content-Type: application/x-www-form-urlencoded
x-companyid: ea8c719489de4ad0bf475477bad43dc6
x-datadigest: pBeXbioZ81xpS9EQq+M4Pw==

company_id=ea8c719489de4ad0bf475477bad43dc6&msg_type=submitAgent&data=%7B%22partner%22%3A%22test%22%2C%22id%22%3A%22xfs101100111011%22%2C%22tradeid%22%3A%222701843%22%2C%22sender%22%3A%7B%22id%22%3A%22131*****010%22%2C%22name%22%3A%22XXX%22%2C%22company%22%3A%22XXXXX%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%22mobile%22%3A%221391***5678%22%2C%22phone%22%3A%22021-87***321%22%2C%22area%22%3A%22310118%22%2C%22city%22%3A%22%E4%B8%8A%E6%B5%B7%2C%E4%B8%8A%E6%B5%B7%E5%B8%82%2C%E9%9D%92%E6%B5%A6%E5%8C%BA%22%2C%22address%22%3A%22%E5%8D%8E%E6%96%B0%E9%95%87%E5%8D%8E%E5%BF%97%E8%B7%AFXXX%E5%8F%B7%22%2C%22zipcode%22%3A%22610012%22%2C%22email%22%3A%22ll%40abc.com%22%2C%22im%22%3A%221924656234%22%2C%22starttime%22%3A%222013-05-20+12%3A00%3A00%22%2C%22endtime%22%3A%222013-05-20+15%3A00%3A00%22%7D%2C%22receiver%22%3A%7B%22id%22%3A%22130520142097%22%2C%22name%22%3A%22XXX%22%2C%22company%22%3A%22XXXX%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%22mobile%22%3A%22136*****321%22%2C%22phone%22%3A%22010-222***89%22%2C%22area%22%3A%22501022%22%2C%22city%22%3A%22%E5%9B%9B%E5%B7%9D%E7%9C%81%2CXXX%2CXXXX%22%2C%22address%22%3A%22%E8%82%B2%E5%BE%B7%E8%B7%AFXXX%E5%8F%B7%22%2C%22zipcode%22%3A%22610012%22%2C%22email%22%3A%22yyj%40abc.com%22%2C%22im%22%3A%22yangyijia-abc%22%7D%2C%22weight%22%3A%220.753%22%2C%22size%22%3A%2212%2C23%2C11%22%2C%22quantity%22%3A%222%22%2C%22price%22%3A%22126.50%22%2C%22freight%22%3A%2210.00%22%2C%22premium%22%3A%220.50%22%2C%22pack_charges%22%3A%221.00%22%2C%22other_charges%22%3A%220.00%22%2C%22order_sum%22%3A%220.00%22%2C%22collect_moneytype%22%3A%22CNY%22%2C%22collect_sum%22%3A%2212.00%22%2C%22remark%22%3A%22%E8%AF%B7%E5%8B%BF%E6%91%94%E8%B4%A7%22%2C%22order_type%22%3A%221%22%7D
curl -X POST \
  http://58.40.16.125:9001/partnerInsertSubmitagent \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'x-companyid: ea8c719489de4ad0bf475477bad43dc6' \
  -H 'x-datadigest: pBeXbioZ81xpS9EQq+M4Pw==' \
  -d 'company_id=ea8c719489de4ad0bf475477bad43dc6&msg_type=submitAgent&data=%7B%22partner%22%3A%22test%22%2C%22id%22%3A%22xfs101100111011%22%2C%22tradeid%22%3A%222701843%22%2C%22sender%22%3A%7B%22id%22%3A%22131*****010%22%2C%22name%22%3A%22XXX%22%2C%22company%22%3A%22XXXXX%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%22mobile%22%3A%221391***5678%22%2C%22phone%22%3A%22021-87***321%22%2C%22area%22%3A%22310118%22%2C%22city%22%3A%22%E4%B8%8A%E6%B5%B7%2C%E4%B8%8A%E6%B5%B7%E5%B8%82%2C%E9%9D%92%E6%B5%A6%E5%8C%BA%22%2C%22address%22%3A%22%E5%8D%8E%E6%96%B0%E9%95%87%E5%8D%8E%E5%BF%97%E8%B7%AFXXX%E5%8F%B7%22%2C%22zipcode%22%3A%22610012%22%2C%22email%22%3A%22ll%40abc.com%22%2C%22im%22%3A%221924656234%22%2C%22starttime%22%3A%222013-05-20%2012%3A00%3A00%22%2C%22endtime%22%3A%222013-05-20%2015%3A00%3A00%22%7D%2C%22receiver%22%3A%7B%22id%22%3A%22130520142097%22%2C%22name%22%3A%22XXX%22%2C%22company%22%3A%22XXXX%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%22%2C%22mobile%22%3A%22136*****321%22%2C%22phone%22%3A%22010-222***89%22%2C%22area%22%3A%22501022%22%2C%22city%22%3A%22%E5%9B%9B%E5%B7%9D%E7%9C%81%2CXXX%2CXXXX%22%2C%22address%22%3A%22%E8%82%B2%E5%BE%B7%E8%B7%AFXXX%E5%8F%B7%22%2C%22zipcode%22%3A%22610012%22%2C%22email%22%3A%22yyj%40abc.com%22%2C%22im%22%3A%22yangyijia-abc%22%7D%2C%22weight%22%3A%220.753%22%2C%22size%22%3A%2212%2C23%2C11%22%2C%22quantity%22%3A%222%22%2C%22price%22%3A%22126.50%22%2C%22freight%22%3A%2210.00%22%2C%22premium%22%3A%220.50%22%2C%22pack_charges%22%3A%221.00%22%2C%22other_charges%22%3A%220.00%22%2C%22order_sum%22%3A%220.00%22%2C%22collect_moneytype%22%3A%22CNY%22%2C%22collect_sum%22%3A%2212.00%22%2C%22remark%22%3A%22%E8%AF%B7%E5%8B%BF%E6%91%94%E8%B4%A7%22%2C%22order_type%22%3A%221%22%7D'

results matching ""

    No results matching ""