# logistics.getPrinter
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.1904090or later (download the latest stable version here), and thewx-server-sdkversion must be0.4.0or later.
Obtains the printer. It is called only when WeChat Waybill Printing software for PC is to be used.
Calling methods:
# HTTPS Call
# Request Address
GET https://api.weixin.qq.com/cgi-bin/express/business/printer/getall?access_token=ACCESS_TOKEN
# Request Parameters
| Attribute | Type | Default | Required | Description |
|---|---|---|---|---|
| access_token | string | Yes | Credentials to call API |
# Return Value
# Object
| Property | Type | Description |
|---|---|---|
| count | number | The quantity of bound printers |
| openid | Array.<string> | The list of openids of the printer |
# Return Data Example
{
"count": 2,
"openid": [
"oABC",
"oXYZ"
]
}
# 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-sdkin the cloud function.
# API Calling Method
openapi.logistics.getPrinter
You need to configure the permissions for the
logistics.getPrinterAPI viaconfig.json. Details
# Return Value
# Object
| Property | Type | Description |
|---|---|---|
| count | number | The quantity of bound printers |
| openid | Array.<string> | The list of openids of the printer |
# Request Example
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.logistics.getPrinter({})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}
# Return Data Example
{
"count": 2,
"openid": [
"oABC",
"oXYZ"
],
"errMsg": "openapi.logistics.getPrinter:ok"
}