目录

Linking/Unlinking Offer Instances

Function

Links/Unlinks offer instances to/from a loyalty card instance.

Scenario

This API is used to link one or more offer instances to a loyalty card instance. Each linked offer instance can be identified by a different appId.

Restrictions

The required services must be enabled in AppGallery Connect beforehand. In addition, only a loyalty card instance that has been added to the Huawei server can be updated. The linked offer instance must have been added to the Huawei server. Otherwise, it cannot be displayed on the device.

Prototype

Protocol

HTTPS PATCH

Direction

Developer server -> HUAWEI Account Kit server

URL

{url}/hmspass/v1/loyalty/instance/{instanceId}/linkedoffers

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

URL Parameters

Parameter

Mandatory/Optional

Type

Description

instanceId

Mandatory

String

Unique identifier of an instance. It must be unique across all instances sharing the same appId. The value contains only letters, digits, dots (.), hyphens (-), and underscores (_).

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

addOffers

Optional

Array<Offer>

Offer instances to be added.

deleteOffers

Optional

Array<Offer>

Offer instances to be deleted.

Offer:

Parameter

Mandatory/Optional

Type

Description

passTypeIdentifier

Mandatory

String

Service ID of the offer instance to be added or deleted.

instanceId

Mandatory

String

ID of an offer instance.

Request Example

PATCH /hmspass/v1/loyalty/instance/40001/linkedoffers 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
{
  "addOffers": [
    {
      "passTypeIdentifier": "hwpass.com.huawei.wallet.offer.test",
      "instanceId": "50001"
    }
  ],
  "deleteOffers": [
    {
      "passTypeIdentifier": "hwpass.com.huawei.wallet.offer.test",
      "instanceId": "50002"
    }
  ]
}

Response Parameters

When the result code is 200:

Parameter

Type

Description

For details, please refer to the HwWalletObject Parameters.

HwWalletObject

Updated pass instance.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json
{
  "passTypeIdentifier": "hwpass.com.huawei.wallet.loyalty.test",
  "passStyleIdentifier": "loyaltyModelTest",
  "organizationPassId": "356688115",
  "serialNumber": "40001",
  "fields": {
    "status": {
      "state": "active",
      "effectTime": "2019-11-13T00:00:00.111Z",
      "expireTime": "2028-11-20T00:00:00.111Z"
    },
    "barCode": {
      "text": "1118466050",
      "type": "codabar",
      "value": "1118466050",
      "encoding": "UTF-8"
    },
    "commonFields": [
      {
        "key": "cardNumber",
        "value": "12345678",
        "label": "Card Number"
      },
      {
        "key": "balance",
        "value": "$666",
        "label": "Balance"
      },
      {
        "key": "memberName",
        "value": "Joe Wiley",
        "label": "Name"
      }
    ],
    "appendFields": [
      {
        "key": "points",
        "value": "1500",
        "label": "Points"
      }
    ],
    "messageList": [
      {
        "key": "message[10]",
        "value": "Hello everyone!"
      }
    ],
    "relatedPassIds": [
      {
        "type": "hwpass.com.huawei.wallet.offer.test",
        "id": "50001"
      }
    ]
  }
}

Result Codes

For details, please refer to Result Codes.