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

WeChat small programs Use batchGetOrder


May 19, 2021 WeChat Mini Program Development Document


Table of contents


logistics.batchGetOrder

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

Get ticket data in bulk

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

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

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
order_list Array.<Object> Is Order list, up to a maximum of 100

order_list structure of the system

Property Type The default Required Description
order_id string Is The order ID
delivery_id string Is Courier company ID, getAllDelivery
waybill_id string Whether The ticket ID

Returns a value

Object

Property Type Description
order_list Array.<Object> A list of tickets
order_status number Ticket status, 0 OK, 1 cancellation

order_list structure of the system

Property Type Description
errcode number Error code
errmsg string The error message
order_id string The order ID
delivery_id string Courier company ID, getAllDelivery
waybill_id string The ticket ID
print_html string BASE64 results for ticket html
waybill_data Array.<Object> Bill of lading information

order_list structure of the .waybill_data

Property Type Description
key string Ticket information key
value string The bill of lading information value

An example of requesting data

{
   "order_list": [
       {
          "order_id": "01234567890123456789",
          "delivery_id": "SF",
          "waybill_id": "123456789"
       },
       {
          "order_id": "01234567890123456789",
          "delivery_id": "SF",
          "waybill_id": "123456789"
       }
   ]
}

Return an example of the data

{
   "order_list": [
       {
          "errcode": 0,
          "errmsg": "ok",
          "order_id": "01234567890123456789",
          "delivery_id": "SF",
          "waybill_id": "123456789",
          "print_html": "jh7DjipP4ul4CQYUh69cniskrQZuOPwa1inAbXIqKbU0t71c0s65Au54cdWBZW0QJY4LYeofdM",
          "waybill_data": [
               {
                   "key": "SF_bagAddr",
                   "value": "广州"
               },
               {
                  "key": "SF_mark",
                  "value": "101- 07-03 509"
               }
           ],
           "order_status": 0
       },
       {
          "errcode": 0,
          "errmsg": "ok",
          "order_id": "01234567890123456789_2",
          "delivery_id": "SF",
          "waybill_id": "123456789_2",
          "print_html": "jh7DjipP4ul4CQYUh69cniskrQZuOPwa1inAbXIqKbU0t71c0s65Au54cdWBZW0QJY4LYeofdM",
          "waybill_data": [
               {
                   "key": "SF_bagAddr",
                   "value": "广州"
               },
               {
                  "key": "SF_mark",
                  "value": "101- 07-03 509"
               }
           ],
           "order_status": 0
       }
   ]
}

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.batchGetOrder
Permissions for the logistics.batchGetOrder API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
orderList Array.<Object> Is Order list, up to a maximum of 100

The structure of orderList

Property Type The default Required Description
orderId string Is The order ID
deliveryId string Is Courier company ID, getAllDelivery
waybillId string Whether The ticket ID

Returns a value

Object

Property Type Description
orderList Array.<Object> A list of tickets
orderStatus number Ticket status, 0 OK, 1 cancellation

The structure of orderList

Property Type Description
errcode number Error code
errmsg string The error message
orderId string The order ID
deliveryId string Courier company ID, getAllDelivery
waybillId string The ticket ID
printHtml string BASE64 results for ticket html
waybillData Array.<Object> Bill of lading information

The structure of orderList.waybillData

Property Type Description
key string Ticket information key
value string The bill of lading information value

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.batchGetOrder({
        orderList: [
          {
            orderId: '01234567890123456789',
            deliveryId: 'SF',
            waybillId: '123456789'
          },
          {
            orderId: '01234567890123456789',
            deliveryId: 'SF',
            waybillId: '123456789'
          }
        ]
      })
    return result
  } catch (err) {
    return err
  }
}

Return an example of the data

{
  "orderList": [
    {
      "errcode": 0,
      "errmsg": "ok",
      "orderId": "01234567890123456789",
      "deliveryId": "SF",
      "waybillId": "123456789",
      "printHtml": "jh7DjipP4ul4CQYUh69cniskrQZuOPwa1inAbXIqKbU0t71c0s65Au54cdWBZW0QJY4LYeofdM",
      "waybillData": [
        {
          "key": "SF_bagAddr",
          "value": "广州"
        },
        {
          "key": "SF_mark",
          "value": "101- 07-03 509"
        }
      ],
      "orderStatus": 0
    },
    {
      "errcode": 0,
      "errmsg": "ok",
      "orderId": "01234567890123456789_2",
      "deliveryId": "SF",
      "waybillId": "123456789_2",
      "printHtml": "jh7DjipP4ul4CQYUh69cniskrQZuOPwa1inAbXIqKbU0t71c0s65Au54cdWBZW0QJY4LYeofdM",
      "waybillData": [
        {
          "key": "SF_bagAddr",
          "value": "广州"
        },
        {
          "key": "SF_mark",
          "value": "101- 07-03 509"
        }
      ],
      "orderStatus": 0
    }
  ],
  "errMsg": "openapi.logistics.batchGetOrder:ok"
}