# logistics.updatePrinter

Call this API at the server side. For more information, see Server API.

This API supports Cloud Calls. The WeChat DevTools version must be 1.02.1904090 or later (download the latest stable version here), and the wx-server-sdk version must be 0.4.0 or later.

Updates the printer. It is called only when WeChat Waybill Printing software for PC is to be used.

Calling methods:

# HTTPS Call

# Request Address

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

# Request Parameters

Attribute Type Default Required Description
access_token string Yes Credentials to call API
openid string Yes The openid of the printer
update_type string Yes The update type

Valid values of update_type

Value Description Minimum Version
bind Bind
unbind Unbind

# Return Value

# Object

Property Type Description
errcode number Error code
errmsg string Error message

Valid values of errcode

Value Description Minimum Version
0 Succeeded
-1 System failure
9300517 Incorrect update_type

# Request Data Example

{
  "openid": "oJ4v0wRAfiXcnIbM3SgGEUkTw3Qw",
  "update_type": "bind"
}

# Return Data Example

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

# Cloud Call

Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via wx-server-sdk in the cloud function.

# API Calling Method

openapi.logistics.updatePrinter

You need to configure the permissions for the logistics.updatePrinter API via config.json. Details

# Request Parameters

Attribute Type Default Required Description
openid string Yes The openid of the printer
updateType string Yes The update type

Valid values of updateType

Value Description Minimum Version
bind Bind
unbind Unbind

# Return Value

# Object

Property Type Description
errCode number Error code
errMsg string Error message

Valid values of errCode

Value Description Minimum Version
0 Succeeded

# Exceptions

# Object

Thrown Exceptions

Property Type Description
errCode number Error code
errMsg string Error message

Valid values of errCode

Value Description Minimum Version
-1 System failure
9300517 Incorrect update_type

# Request Data Example

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'
      })
      console.log(result)
      return result
    } catch (err) {
      console.log(err)
      return err
    }
  }

# Return Data Example

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