文档中心 > API类目 > 手淘开放API

taobao.logistics.openalibity.write (为快递公司提供的物流信息通用写入接口)

为快递公司提供的物流信息通用写入接口

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
general_logistics_data_write_request GeneralLogisticsDataWriteRequest 必须 信息写入请求对象
  • └ cp_code
  • String
  • 必须
  • ZTO
  • 快递公司标准编码
  • └ mail_no
  • String
  • 必须
  • 881772767996
  • 运单号
  • └ current_logistics_status
  • String
  • 可选
  • CONSIGN
  • 运单关联包裹的当前物流状态,需和平台侧定义的枚举名保持一致。
  • └ receiver_phone
  • String
  • 可选
  • 19910102020
  • 运单关联包裹的收件人手机号,该字段尽量提供,用于检索用户信息并进行身份核对。若同时缺失openid和phone,则无法核对用户信息,导致数据存储失败
  • └ extend_param
  • String
  • 必须
  • {"isSupportDeliveryHome": "1", "hasSignPic": "0"}
  • 待写入的数据,key值需要按照平台侧定义的标准。isSupportDeliveryHome:是否支持送货上门。hasSignPic:是否有签收照片。value为String类型,1代表真,0代表假
  • └ openid
  • String
  • 可选
  • 0
  • 用户在手淘中登陆并授权小程序后的唯一标识。登陆过淘宝小程序的用户都会有一个openid,如果有尽量传过来,因为如果缺少openid,则无法判断用户是否为高活用户,也就无法决策是否推送push消息
  • └ package_type
  • String
  • 可选
  • INTERNAL
  • INTERNAL:淘内包裹,EXTERNAL:淘外包裹
  • └ scene
  • String
  • 必须
  • DELIVERY_HOME
  • DELIVERY_HOME:送货上门。SIGN_PIC:签收照片

响应参数

名称 类型 示例值 描述
result_msg String exceedLimit 接口调用失败信息
write_response GeneralLogisticsDataWriteResponse 信息写入返回结果对象
  • └ success
  • Boolean
  • true
  • 信息写入是否成功
  • └ error_code
  • String
  • 500
  • 信息写入错误码
  • └ error_msg
  • String
  • invalidParam
  • 信息写入错误信息
result_code String 500 接口调用失败码
result_success Boolean true 接口调用是否成功

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
LogisticsOpenalibityWriteRequest req = new LogisticsOpenalibityWriteRequest();
LogisticsOpenalibityWriteRequest.GeneralLogisticsDataWriteRequest obj1 = new LogisticsOpenalibityWriteRequest.GeneralLogisticsDataWriteRequest();
obj1.setCpCode("ZTO");
obj1.setMailNo("881772767996");
obj1.setCurrentLogisticsStatus("CONSIGN");
obj1.setReceiverPhone("19910102020");
obj1.setExtendParam("{\"isSupportDeliveryHome\": \"1\", \"hasSignPic\": \"0\"}");
obj1.setOpenid("0");
obj1.setPackageType("INTERNAL");
obj1.setScene("DELIVERY_HOME");
req.setGeneralLogisticsDataWriteRequest(obj1);
LogisticsOpenalibityWriteResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<logistics_openalibity_write_response>
    <result_msg>exceedLimit</result_msg>
    <write_response>
        <success>true</success>
        <error_code>500</error_code>
        <error_msg>invalidParam</error_msg>
    </write_response>
    <result_code>500</result_code>
    <result_success>true</result_success>
</logistics_openalibity_write_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案
noFoundOrder 根据cpCode和mailNo查询pcs,没有查到该运单关联的交易订单信息 可忽略
noFoundBuyer 根据cpCode和mailNo查询pcs,查询到交易订单信息中,但订单信息中缺少买家信息 这类运单为逆向换货运单,已交由逆向侧同学修复,预计11.23上线
findNoPackage 从pcs根据mailNo和cpCode没有找到运单关联的包裹信息 淘外包裹,可忽略

API工具

如何获得此API

FAQ

返回
顶部