Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small programs Small programs use getPath


May 19, 2021 WeChat Mini Program Development Document


Table of contents


logistics.getPath

This interface should be called on the server side, as detailed in the Service Side API.
This interface supports cloud calls. Developer tool version required . . . 1.02.1904090 (latest stable download)
wx-server-sdk >= 0.4.0

Query the way order track

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

POST https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token=ACCESS_TOKEN

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
order_id string Is Order ID, global unique
Openid string Whether User openid, no need to add_source when the user is 2 (no logistics service notifications are sent)
delivery_id string Is Courier company ID, getAllDelivery
waybill_id string Is The ticket ID

Returns a value

Object

Property Type Description
Openid string User openid
delivery_id string Courier ID
waybill_id string The ticket ID
path_item_num number The number of track nodes
path_item_list Array.<Object> The list of track nodes

path_item_list structure of the system

Property Type Description
action_time number Track node Unix timestamp
action_type number The type of track node
action_msg string Track node details

action_type legal value of the data

Value Description The lowest version
100001 Tout stage - Touting success
100002 Tout phase - Tout failed
100003 Tout phase - assign salesman
200001 Transport Phase - Update the transport track
300002 Delivery Phase - Start delivery
300003 Delivery phase - signing success
300004 Delivery phase - signing failed
400001 Abnormal stage - order cancellation
400002 Abnormal stage - order retention

Request data example

{
  "order_id": "01234567890123456789",
  "openid": "oABC123456",
  "delivery_id": "SF",
  "waybill_id": "123456789"
}

Return an example of the data

{
  "openid": "OPENID",
  "delivery_id": "SF",
  "waybill_id": "12345678901234567890",
  "path_item_num": 3,
  "path_item_list": [
    {
      "action_time": 1533052800,
      "action_type": 100001,
      "action_msg": "快递员已成功取件"
    },
    {
      "action_time": 1533062800,
      "action_type": 200001,
      "action_msg": "快件已到达xxx集散中心,准备发往xxx"
    },
    {
      "action_time": 1533072800,
      "action_type": 300001,
      "action_msg": "快递员已出发,联系电话xxxxxx"
    }
  ]
}

Cloud calls

Cloud call is the ability provided by the small program Cloud Development to call WeChat open interfaces in cloud functions and need to be used in cloud functions via wx-server-sdk.

The interface method

openapi.logistics.getPath
Permissions for the logistics.getPath API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
orderId string Is Order ID, global unique
Openid string Whether User openid, no need to add_source when the user is 2 (no logistics service notifications are sent)
deliveryId string Is Courier company ID, getAllDelivery
waybillId string Is The ticket ID

Returns a value

Object

Property Type Description
Openid string User openid
deliveryId string Courier ID
waybillId string The ticket ID
pathItemNum number The number of track nodes
pathItemList Array.<Object> The list of track nodes

The structure of pathItemList

Property Type Description
actionTime number Track node Unix timestamp
actionType number The type of track node
actionMsg string Track node details

The legal value of actionType

Value Description The lowest version
100001 Tout stage - Touting success
100002 Tout phase - Tout failed
100003 Tout phase - assign salesman
200001 Transport Phase - Update the transport track
300002 Delivery Phase - Start delivery
300003 Delivery Phase - Signed successfully
300004 Delivery phase - sign-off failed
400001 Abnormal Stage - Order Cancellation
400002 Abnormal phase - order stranded

An example of requesting data

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.logistics.getPath({
        openid: 'oABC123456',
        orderId: '01234567890123456789',
        deliveryId: 'SF',
        waybillId: '123456789'
      })
    return result
  } catch (err) {
    return err
  }
}

Return an example of the data

{
  "openid": "OPENID",
  "deliveryId": "SF",
  "waybillId": "12345678901234567890",
  "pathItemNum": 3,
  "pathItemList": [
    {
      "actionTime": 1533052800,
      "actionType": 100001,
      "actionMsg": "快递员已成功取件"
    },
    {
      "actionTime": 1533062800,
      "actionType": 200001,
      "actionMsg": "快件已到达xxx集散中心,准备发往xxx"
    },
    {
      "actionTime": 1533072800,
      "actionType": 300001,
      "actionMsg": "快递员已出发,联系电话xxxxxx"
    }
  ],
  "errMsg": "openapi.logistics.getPath:ok"
}