物流助手 /小程序使用 /getPrinter

# logistics.getPrinter

> 本接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。

> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`

获取打印员。若需要使用[微信打单 PC 软件](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry-test/test/express-download.html),才需要调用。

调用方式:

- [HTTPS 调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPrinter.html#method-http)
- [云调用](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/by-business/logistics.getPrinter.html#method-cloud)



## HTTPS 调用

### 请求地址

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

### 请求参数

| 属性                                  | 类型   | 默认值 | 必填 | 说明                                                         |
| :------------------------------------ | :----- | :----- | :--- | :----------------------------------------------------------- |
| access_token / cloudbase_access_token | string |        | 是   | [接口调用凭证](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html) |

### 返回值

### Object

### 返回数据示例

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



## 云调用

> [云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)是微信云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 `wx-server-sdk` 使用。

### 接口方法

```js
openapi.logistics.getPrinter
```

> 需在 `config.json` 中配置 `logistics.getPrinter` API 的权限,[详情](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html#usage-3)

### 返回值

### Object

### 请求示例

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

### 返回数据示例

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