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

WeChat small programs Small programs use getPrinter


May 19, 2021 WeChat Mini Program Development Document


Table of contents


logistics.getPrinter

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 the printer. If you need to use WeChat single PC software, you need to call.

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

GET https://api.weixin.qq.com/cgi-bin/express/business/printer/getall?access_token=ACCESS_TOKEN

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials

Returns a value

Object

Return an example of the data

{
 "count": 2,
 "openid": [
   "oABC",
   "oXYZ"
 ],
 "tagid_list": [
   "123",
   "456"
 ]
}

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

Returns a value

Object

An example of a request

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.logistics.getPrinter({})
    return result
  } catch (err) {
    return err
  }
}

Return an example of the data

{
  "count": 2,
  "openid": [
    "oABC",
    "oXYZ"
  ],
  "tagidList": [
    "123",
    "456"
  ],
  "errMsg": "openapi.logistics.getPrinter:ok"
}