应用接入说明


测试时,需在测试环境中注册一个开发者账号。

如果是自研系统只是自己账号使用,可以申请固定token,不对接授权流程,不需要注册开发者账号。

1、注册成为开发者

测试环境开发者登陆/注册地址:http://developers.ck1info.com

正式环境开发者登陆/注册地址:http://developers.chukou1.cn

2、创建应用

注册并登陆后就可以自行创建应用。创建应用后可以得到ClientId、Secret等关键信息。选取应用权限时,选择OpenApi,并提交审核;审核通过后再第三步。

3、应用授权

创建应用后,可以向客户开放授权。客户授权后得到临时授权码code。使用code获取令牌(AccessToken)。授权说明

4、审核并上线

在测试环境测试对接成功后,在正式环境走同样的流程即可。


对接联系QQ : 2063132306

业务系统测试环境 : http://yewu.ck1info.com/Client/Index.aspx

业务系统测试用客户:

客户账号 登陆密码 客户代码
HUIW 111111 HUIW

接口用例


Api调用说明


1.测试环境接口地址: http://openapi.ck1info.com/

2.正式环境接口地址: https://openapi.chukou1.cn

3.调用接口都需要在Header添加:Authorization: Bearer {AccessToken} 和 Content-Type: application/json; charset=utf-8。

4.返回httpcode:200(成功),201(创建成功),404(找不到资源)、400(错误请求)、500(服务器错误)、401(验证错误)、412(不满足条件)

5.接口调用的时候,接口文档中的url要根据实际使用情况拼接,
比如:创建直发订单{domain}/v1/directExpressOrders,
在测试环境中Url是:http://openapi.ck1info.com//v1/directExpressOrders
在正式环境中Url是:http://openapi.ck1info.com/v1/directExpressOrders

示例1:创建直发订单

URL:

Post  http://openapi.ck1info.com/v1/directExpressOrders

Header:

Authorization: Bearer {AccessToken}
Content-Type: application/json; charset=utf-8

Body:

{
  "Location": "GZ",
  "Package": {
    "PackageId": "SMT23015236489",
    "ServiceCode": "CUE",
    "ShipToAddress": {
      "Country": "US",
      "Province": "Florida",
      "City": "Coral Springs",
      "Street1": "9110 NW 21st street ",
      "Postcode": "45429",
      "Contact": "David Mcaffee",
      "Phone": "937-689-8216",
      "Email": "23541566@gmail.com"
    },
    "Weight": 600,
    "Length": 25,
    "Width": 10,
    "Height": 20,
    "Skus": [
      {
        "Sku": "bag-y001",
        "Quantity": 1,
        "Weight": 600,
        "DeclareValue": 5,
        "DeclareNameEn": "bag",
        "DeclareNameCn": "小梦书包",
        "ProductName": "bag-red",
        "Price": 5
      },
      {
        "Sku": "bag-y002",
        "Quantity": 2,
        "Weight": 600,
        "DeclareValue": 5,
        "DeclareNameEn": "bag",
        "DeclareNameCn": "小梦书包",
        "ProductName": "bag-red",
        "Price": 5
      }
    ],
    "SellPrice": 20,
    "SellPriceCurrency": "CNY",
    "SalesPlatform": "Ebay",
    "Custom": "bag-red*1",
    "Remark": "bag-red*1"
  },
  "Remark": "remark"
}
                

Result:

httpcode: 201
示例2:查询中国直发服务列表

URL:

Get  http://openapi.ck1info.com/v1/directExpressServices

Header:

Authorization: Bearer {AccessToken}
Content-Type: application/json; charset=utf-8

Result:

httpcode: 200
[
  {
    "ServiceCode": "UPS",
    "ServiceName": "CK1无限电",
    "IsTracking": true,
    "InService": true,
    "CanImportTracking": true
  },
  {
    "ServiceCode": "NLR",
    "ServiceName": "Easy邮",
    "IsTracking": true,
    "InService": true,
    "CanImportTracking": false
  },
  {
    "ServiceCode": "DGR",
    "ServiceName": "DHL小包挂号",
    "IsTracking": true,
    "InService": true,
    "CanImportTracking": false
  }
]
示例3:获取中国直发订单状态

URL:

Get  http://openapi.ck1info.com/v1/directExpressOrders/Sh0983125305/status

Header:

Authorization: Bearer {AccessToken}
Content-Type: application/json; charset=utf-8

Result:

httpcode: 404
{
 "Errors":
    [
     {
       "Code":"800F1533",
       "Message":"直发订单Sh0983125305不存在"
     }
    ],
 "TicketId":"b8ccb8c1-1b03-4380-a820-b34f153730d1",
 "UtcDateTime":"2016-03-20T07:19:25Z",
 "RequestUri":"http://openapi.ck1info.com/v1/directExpressOrders/Sh0983125305/status"
}