Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
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.
HMS Core
Updates some parameters of a gift card model based on modelId.
This API is used to update some parameters of a gift card model based on modelId. All parameters except passTypeIdentifier and passStyleIdentifier (namely, modelId) can be updated. After you modify a pass model, all passes using this model and claimed by users will be updated accordingly. For details about the update scenarios, please refer to Synchronous and Asynchronous Update.
You need to create an app in AppGallery Connect and apply for services corresponding to the passes. In addition, only a model that has been added to the Huawei server can be updated.
Protocol |
HTTPS PATCH |
|---|---|
Direction |
Developer server -> Huawei server |
URL |
{url}/hmspass/v1/giftcard/model/{modelId} 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 |
Parameter |
Mandatory/Optional |
Type |
Description |
|---|---|---|---|
modelId |
Mandatory |
String |
Unique identifier of a pass model. It must be unique across all models sharing the same appId. The value contains only letters, digits, dots (.), hyphens (-), and underscores (_). |
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 |
|---|---|---|---|
For details, please refer to the HwWalletObject Parameters. |
Mandatory |
Pass model to be updated. |
- PATCH /hmspass/v1/giftcard/model/giftCardModelTest 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.cnm
- {
- "fields": {
- "commonFields": [
- {
- "key": "logo",
- "value": "https://www.huawei.com/new_image_url.png"
- }
- ]
- }
- }
When the result code is 200:
Parameter |
Type |
Description |
|---|---|---|
For details, please refer to the HwWalletObject parameters. |
Updated pass model. |
- HTTP/1.1 200 OK
- Content-Type: application/json
- {
- "passVersion": "2.0",
- "passTypeIdentifier": "hwpass.com.huawei.wallet.giftcard.test",
- "passStyleIdentifier": "giftCardModelTest",
- "organizationName": "Huawei",
- "fields": {
- "countryCode": "CN",
- "locationList": [
- {
- "longitude": "114.0679603815",
- "latitude": "22.6592051284"
- }
- ],
- "commonFields": [
- {
- "key": "logo",
- "value": "https://www.huawei.com/new_image_url.png"
- },
- {
- "key": "backgroundImage",
- "value": "https://www.huawei.com/XXX.png"
- },
- {
- "key": "name",
- "value": "Christmas Gift Card"
- },
- {
- "key": "merchantName",
- "value": "XXX Super Market",
- "localizedValue": "merchantNameI18N"
- },
- {
- "key": "eventNumber",
- "value": "223421510894697",
- "label": "Event Number",
- "localizedValue": "eventNameI18n"
- }
- ],
- "appendFields": [
- {
- "key": "backgroundColor",
- "value": "#483d8b"
- },
- {
- "key": "hotline",
- "value": "8006011450"
- },
- {
- "key": "website",
- "value": "https://www.huawei.com"
- }
- ],
- "messageList": [
- {
- "key": "message[0]",
- "value": "Welcome to use this gift card.",
- "label": "Welcome"
- },
- {
- "key": "message[1]",
- "value": "This gift card can only be used on Christmas Eve.",
- "label": "Explanation"
- }
- ],
- "imageList": [
- {
- "key": "mainImage[0]",
- "value": "https://www.huawei.com/XXX0.png"
- },
- {
- "key": "mainImage[1]",
- "value": "https://www.huawei.com/XXX1.png"
- },
- {
- "key": "mainImage[2]",
- "value": "https://www.huawei.com/XXX2.png"
- }
- ],
- "localized": [
- {
- "key": "merchantNameI18N",
- "language": "zh-cn",
- "value": "XXX Super Market"
- },
- {
- "key": "merchantNameI18N",
- "language": "en",
- "value": "XXX Super Market"
- },
- {
- "key": "eventNumberI18N",
- "language": "zh-cn",
- "value": "Event Number"
- },
- {
- "key": "eventNumberI18N",
- "language": "en",
- "value": "Event Number"
- }
- ]
- }
- }
For details, please refer to Result Codes.
- public HwWalletObject partialUpdateWalletModel(String url, String modelId, String body) {
- // Construct the HTTP header.
- HttpHeaders header = constructHttpHeaders();
- // Construct the HTTP URL.
- String baseUrl = ConfigHelper.instants().getValue("walletServerBaseUrl");
- String walletServerUrl = baseUrl + url + modelId;
- // Construct the HTTP body.
- JSONObject jsonObj = JSONObject.parseObject(body);
-
- // Send the HTTP request and obtain the response.
- HttpEntity<JSONObject> entity = new HttpEntity<>(jsonObj, header);
- ResponseEntity<HwWalletObject> response =
- REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.PATCH, entity, HwWalletObject.class);
-
- // Return the updated wallet model.
- return response.getBody();
- }
Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Quick start
Helps you find desired resources with ease.