We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

Updating the Entire Boarding Pass Instance

Function

Overwrites a boarding pass instance based on instanceId.

Scenario

This API is used to update the entire boarding pass instance based on instanceId. All parameters except passTypeIdentifier, organizationPassId, and serialNumber (namely, instanceId) can be updated. The value of passStyleIdentifier (namely, modelId) can be changed to another boarding pass model ID with the same passTypeIdentifier.

Restrictions

You need to create an app in AppGallery Connect and apply for services corresponding to the passes. In addition, only an instance that has been added to the Huawei server can be updated.

Prototype

Protocol

HTTPS PUT

Direction

Developer server -> Huawei server

URL

{url}/hmspass/v1/flight/instance/{instanceId}

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

Expand

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

Expand

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

Expand

Parameter

Mandatory/Optional

Type

Description

For details, please refer to the HwWalletObject Parameters.

Mandatory

HwWalletObject

Pass instance to be updated.

Request Example

PUT /hmspass/v1/flight/instance/20001 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
{
  "organizationPassId": "5623489692",
  "passTypeIdentifier": "hwpass.com.huawei.wallet.flight.test",
  "passStyleIdentifier": "flightModelTest",
  "serialNumber": "20001",
  "fields": {
    "status": {
      "state": "active",
      "effectTime": "2019-11-13T00:00:00.111Z",
      "expireTime": "2020-11-20T00:00:00.111Z"
    },
    "barCode": {
      "text": "5623489692",
      "type": "qrCode",
      "value": "5623489692",
      "encoding": "UTF-8"
    },
    "commonFields": [
      {
        "key": "seatNumber",
        "value": "15B"
      },
      {
        "key": "passengerName",
        "value": "Wang Xiao"
      },
      {
        "key": "boardingSequence",
        "value": "2"
      },
      {
        "key": "flightClass",
        "value": "Business Class"
      }
    ],
    "appendFields": [
      {
        "key": "confirmationNumber",
        "value": "ITK919"
      }
    ]
  }
}

Response Parameters

When the result code is 200:

Expand

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
{
  "organizationPassId": "5623489692",
  "passTypeIdentifier": "hwpass.com.huawei.wallet.flight.test",
  "passStyleIdentifier": "flightModelTest",
  "serialNumber": "20001",
  "fields": {
    "status": {
      "state": "active",
      "effectTime": "2019-11-13T00:00:00.111Z",
      "expireTime": "2020-11-20T00:00:00.111Z"
    },
    "barCode": {
      "text": "5623489692",
      "type": "qrCode",
      "value": "5623489692",
      "encoding": "UTF-8"
    },
    "commonFields": [
      {
        "key": "seatNumber",
        "value": "15B"
      },
      {
        "key": "passengerName",
        "value": "Wang Xiao"
      },
      {
        "key": "boardingSequence",
        "value": "2"
      },
      {
        "key": "flightClass",
        "value": "Business Class"
      }
    ],
    "appendFields": [
      {
        "key": "confirmationNumber",
        "value": "ITK919"
      }
    ]
  }
}

Result Codes

For details, please refer to Result Codes.

Call Example

public HwWalletObject fullUpdateWalletInstance(String url, String instanceId, HwWalletObject body) {
    // Construct the HTTP header.
    HttpHeaders header = constructHttpHeaders();
    // Construct the HTTP URL.
    String baseUrl = ConfigHelper.instants().getValue("walletServerBaseUrl");
    String walletServerUrl = baseUrl + url + instanceId;
    // Construct the HTTP body.
    String hwLoyaltyInstance = CommonUtil.toJson(body);
    JSONObject jsonObj = JSONObject.parseObject(hwLoyaltyInstance);

    // Send the HTTP request and obtain the response.
    HttpEntity<JSONObject> entity = new HttpEntity<>(jsonObj, header);
    ResponseEntity<HwWalletObject> response =
        REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.PUT, entity, HwWalletObject.class);

    // Return the updated wallet instance.
    return response.getBody();
}
Search
Enter a keyword.