目录

Pushing Messages to Users Who Use the NFC Capability

Function

Pushes messages to users who use the NFC capability of HUAWEI Wallet.

Scenario

If you enable the NFC capability for your passes and register an NFC callback address in AppGallery Connect, when a user uses the NFC capability of HUAWEI Wallet, the Huawei server will send a notification carrying noticeToken to your app server through the Callback Notification API for NFC Pass Events API. You can use noticeToken to call this API to push messages to the user. For example, after a user swipes a community access card, your app server will be notified and push messages about to-be-received packages to the user.

Restrictions

To use this API, you must enable the NFC capability for your passes and register an NFC callback address in AppGallery Connect. Call this API after receiving the request sent from the Callback Notification API for NFC Pass Events API.

Prototype

Protocol

HTTPS POST

Direction

Developer server -> Huawei server

URL

{url}/hmspass/v1/callbackevent/pushmsg

Set the {url} variable based on the region where the server is located. For details, please refer to Wallet Server Addresses.

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

Request Parameters

Request Header

Parameter

Mandatory/Optional

Type

Description

Authorization

Mandatory

String

Authorization code. For details about how to obtain the value, please refer to the Client Credentials mode in OAuth 2.0-based Authentication. In this mode, client_id and client_secret are respectively the App ID and App key of the app that you created in AppGallery Connect. Concatenate the value of access_token to the end of Bearer, with a space in between, to generate the value of Authorization.

Content-Type

Mandatory

String

The value is always application/json;charset=utf-8.

Accept

Mandatory

String

The value is always application/json;charset=utf-8.

Request Body

Parameter

Mandatory/Optional

Type

Description

noticeToken

Mandatory

String(64)

Token corresponding to an NFC event, which is provided by the Callback Notification API for NFC Pass Events API.

message

Mandatory

String(256)

Message to be pushed to a user.

Request Example

POST /hmspass/v1/callbackevent/pushmsg HTTP/1.1
Content-Type: application/json;charset=utf-8
Authorization: Bearer ***
Accept: application/json;charset=utf-8
Host: wallet-passentrust-drcn.cloud.huawei.com.cn
{
  "noticeToken": "3edc0efa7d2e186652d38b19f643dc0e57e7f4e1eb43d889b5678f810f64fd18",
  "message": "You have a message."
}

Response Parameters

When the result code is 200:

Parameter

Type

Description

returnCode

String

Return code. The value 0 indicates success.

returnDesc

String

Return description. The value is success when the return code is 0.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json
{
  "returnCode": "0",
  "returnDesc": "success"
}