# logistics.getContact
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 contact information from a waybill.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/cgi-bin/express/delivery/contact/get?access_token=ACCESS_TOKEN
# Request Parameters
| Attribute | Type | Default | Required | Description |
|---|---|---|---|---|
| access_token | string | Yes | Credentials to call API | |
| token | string | Yes | The Token field pushed in the Order Placement Event on the merchant side. | |
| waybill_id | string | Yes | The ID of the waybill. |
# Return Value
# Object
| Property | Type | Description |
|---|---|---|
| waybill_id | string | The ID of the waybill |
| sender | Array.<Object> | Sender information |
| receiver | Array.<Object> | Receiver information |
| errcode | number | Error code |
| errmsg | string | Error message |
sender is composed as follows
| Property | Type | Description |
|---|---|---|
| address | string | The address. The province, city, and district information are combined. |
| name | string | The name of the user. |
| tel | string | The telephone number. |
| mobile | string | The mobile number. |
receiver is composed as follows
| Property | Type | Description |
|---|---|---|
| address | string | The address. The province, city, and district information are combined. |
| name | string | The name of the user. |
| tel | string | The telephone number. |
| mobile | string | The mobile number. |
Valid values of errcode
| Value | Description | Minimum Version |
|---|---|---|
| 0 | Succeeded | |
| -1 | Other errors | |
| 40199 | Incorrect waybill ID. The waybill is not found. | |
| 9300507 | Incorrect token. |
# Request Data Example
{
"token": "TOKEN",
"waybill_id": "12345678901234567890"
}
# Return Data Example
{
"waybill_id": "12345678901234567890",
"sender": {
"address": "xx on Block XX, XX Building, No. XX, XX Road, Haizhu District, Guangzhou, Guangdong Province",
"name": "Jim",
"tel": "020-88888888",
"mobile": "18666666666"
},
"receiver": {
"address": "xx, Block XX, XX Building, No. XX, XX Road, Tianhe District, Guangzhou, Guangdong Province",
"name": "Wang Xiaomeng",
"tel": "029-77777777",
"mobile": "18610000000"
}
}
# 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.getContact
You need to configure the permissions for the
logistics.getContactAPI viaconfig.json. Details
# Request Parameters
| Attribute | Type | Default | Required | Description |
|---|---|---|---|---|
| token | string | Yes | The Token field pushed in the Order Placement Event on the merchant side. | |
| waybillId | string | Yes | The ID of the waybill. |
# Return Value
# Object
| Property | Type | Description |
|---|---|---|
| waybillId | string | The ID of the waybill |
| sender | Array.<Object> | Sender information |
| receiver | Array.<Object> | Receiver information |
| errCode | number | Error code |
| errMsg | string | Error message |
sender is composed as follows
| Property | Type | Description |
|---|---|---|
| address | string | The address. The province, city, and district information are combined. |
| name | string | The name of the user. |
| tel | string | The telephone number. |
| mobile | string | The mobile number. |
receiver is composed as follows
| Property | Type | Description |
|---|---|---|
| address | string | The address. The province, city, and district information are combined. |
| name | string | The name of the user. |
| tel | string | The telephone number. |
| mobile | string | The mobile number. |
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 | Other errors | |
| 40199 | Incorrect waybill ID. The waybill is not found. | |
| 9300507 | Incorrect token. |
# Request Data Example
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.logistics.getContact({
token: 'TOKEN',
waybillId: '12345678901234567890'
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}
# Return Data Example
{
"waybillId": "12345678901234567890",
"sender": {
"address": "xx on Block XX, XX Building, No. XX, XX Road, Haizhu District, Guangzhou, Guangdong Province",
"name": "Jim",
"tel": "020-88888888",
"mobile": "18666666666"
},
"receiver": {
"address": "xx, Block XX, XX Building, No. XX, XX Road, Tianhe District, Guangzhou, Guangdong Province",
"name": "Wang Xiaomeng",
"tel": "029-77777777",
"mobile": "18610000000"
},
"errMsg": "openapi.logistics.getContact:ok"
}