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

WeChat small programs Small programs use updatePrinter


May 19, 2021 WeChat Mini Program Development Document


Table of contents


logistics.updatePrinter

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

Configure the face single printer, you can set up more than one, 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

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

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
Openid string Is Printer openid
update_type string Is The type of update
tagid_list string Whether For platform-type small programs to set the resident printer face single printing permissions, the same printer supports up to 10 tagids, separated by a half-angle comma, with no spaces in the middle, such as filling in 123,456, indicating that the printer can pull to the tagid 123 and 456 under the single, non-platform small programs do not need to fill in the field

update_type legal value of the data

Value Description The lowest version
bind Binding
unbind Unbind

Returns a value

Object

Property Type Description
errcode number Error code
errmsg string The error message

The legal value of errcode

Value Description The lowest version
0 Success
-1 The system failed
9300517 update_type is incorrect

An example of requesting data

{
  "openid": "oJ4v0wRAfiXcnIbM3SgGEUkTw3Qw",
  "update_type": "bind",
  "tagid_list": "123,456"
}

Return an example of the data

{
  "errcode": 0,
  "errmsg": "ok"
}

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

Request parameters

Property Type The default Required Description
Openid string Is Printer openid
updateType string Is The type of update
tagidList string Whether For platform-type small programs to set the resident printer face single printing permissions, the same printer supports up to 10 tagids, separated by a half-angle comma, with no spaces in the middle, such as filling in 123,456, indicating that the printer can pull to the tagid 123 and 456 under the single, non-platform small programs do not need to fill in the field

The legal value of updateType

Value Description The lowest version
bind Binding
unbind Unbind

Returns a value

Object

Property Type Description
errCode number Error code
errMsg string The error message

The legal value of errCode

Value Description The lowest version
0 Success

Abnormal

Object

The exception thrown

Property Type Description
errCode number Error code
errMsg string The error message

The legal value of errCode

Value Description The lowest version
-1 The system failed
9300517 update_type is incorrect

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.updatePrinter({
        openid: 'oJ4v0wRAfiXcnIbM3SgGEUkTw3Qw',
        updateType: 'bind',
        tagidList: '123,456'
      })
    return result
  } catch (err) {
    return err
  }
}

Return an example of the data

{
  "errCode": 0,
  "errMsg": "openapi.logistics.updatePrinter:ok"
}