文档管理中心
API参考钱包服务REST开发者调用接口卡券创建、查询、修改接口登机牌接口全量更新登机牌个人化实例

全量更新登机牌个人化实例

功能介绍

重写instanceId对应的登机牌个人化实例。

场景描述

开发者可以调用该API,全量更新instanceId对应的登机牌个人化实例。除了passTypeIdentifier、organizationPassId和serialNumber(instanceId),其余字段均可更新。可以将passStyleIdentifier(modelId)修改为属于同一个passTypeIdentifier的另一个登机牌模板的ID。

使用约束

需在华为AGC网站上创建应用并申请卡券对应的服务。只能更新已添加到华为服务器的卡券实例。

接口原型

承载协议

HTTPS PUT

接口方向

开发者服务器->华为钱包服务器

接口URL

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

{url}变量需要开发者根据服务器所属区域自行选择,请参见钱包服务器地址

数据格式

请求消息:Content-Type: application/json

响应消息:Content-Type: application/json

路径参数

展开

参数

是否必选

参数类型

描述

instanceId

String

个人化实例的唯一标识符。这个ID在同一个appId下唯一。这个ID只能包含字母、数字和(.)、(-)、(_)。

请求参数

Request Header

展开

参数

是否必选

参数类型

描述

Authorization

String

鉴权码。获取方式详见基于OAuth 2.0开放鉴权,请使用“客户端模式”。“client_id”和“client_secret”即为开发者在华为AGC网站上创建应用后获取的“App ID”和“App key”。将获取到的“access_token”的值拼接在字符串“Bearer”之后,以空格符相隔,组成“Authorization”参数的值。

Content-Type

String

固定值:“application/json;charset=utf-8”。

Accept

String

固定值:“application/json;charset=utf-8”。

Request Body

展开

参数

是否必选

参数类型

描述

详见HwWalletObject参数描述

HwWalletObject

待更新的卡券实例

请求示例

收起
自动换行
深色代码主题
复制
  1. PUT /hmspass/v1/flight/instance/20001 HTTP/1.1
  2. Content-Type: application/json;charset=utf-8
  3. Authorization: Bearer ***
  4. Accept: application/json;charset=utf-8
  5. Host: wallet-passentrust-drcn.cloud.huawei.com.cn
  6. {
  7. "organizationPassId": "5623489692",
  8. "passTypeIdentifier": "hwpass.com.huawei.wallet.flight.test",
  9. "passStyleIdentifier": "flightModelTest",
  10. "serialNumber": "20001",
  11. "fields": {
  12. "status": {
  13. "state": "active",
  14. "effectTime": "2019-11-13T00:00:00.111Z",
  15. "expireTime": "2020-11-20T00:00:00.111Z"
  16. },
  17. "barCode": {
  18. "text": "5623489692",
  19. "type": "qrCode",
  20. "value": "5623489692",
  21. "encoding": "UTF-8"
  22. },
  23. "commonFields": [
  24. {
  25. "key": "seatNumber",
  26. "value": "15B"
  27. },
  28. {
  29. "key": "passengerName",
  30. "value": "Wang Xiao"
  31. },
  32. {
  33. "key": "boardingSequence",
  34. "value": "2"
  35. },
  36. {
  37. "key": "flightClass",
  38. "value": "Business Class"
  39. }
  40. ],
  41. "appendFields": [
  42. {
  43. "key": "confirmationNumber",
  44. "value": "ITK919"
  45. }
  46. ]
  47. }
  48. }

响应参数

错误码为200时:

展开

参数

参数类型

描述

详见HwWalletObject参数描述

HwWalletObject

已更新的卡券实例

响应示例

收起
自动换行
深色代码主题
复制
  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. {
  4. "organizationPassId": "5623489692",
  5. "passTypeIdentifier": "hwpass.com.huawei.wallet.flight.test",
  6. "passStyleIdentifier": "flightModelTest",
  7. "serialNumber": "20001",
  8. "fields": {
  9. "status": {
  10. "state": "active",
  11. "effectTime": "2019-11-13T00:00:00.111Z",
  12. "expireTime": "2020-11-20T00:00:00.111Z"
  13. },
  14. "barCode": {
  15. "text": "5623489692",
  16. "type": "qrCode",
  17. "value": "5623489692",
  18. "encoding": "UTF-8"
  19. },
  20. "commonFields": [
  21. {
  22. "key": "seatNumber",
  23. "value": "15B"
  24. },
  25. {
  26. "key": "passengerName",
  27. "value": "Wang Xiao"
  28. },
  29. {
  30. "key": "boardingSequence",
  31. "value": "2"
  32. },
  33. {
  34. "key": "flightClass",
  35. "value": "Business Class"
  36. }
  37. ],
  38. "appendFields": [
  39. {
  40. "key": "confirmationNumber",
  41. "value": "ITK919"
  42. }
  43. ]
  44. }
  45. }

错误码

详见错误码

调用示例

收起
自动换行
深色代码主题
复制
  1. public HwWalletObject fullUpdateWalletInstance(String url, String instanceId, HwWalletObject body) {
  2. // Construct the http header.
  3. HttpHeaders header = constructHttpHeaders();
  4. // Construct the http URL.
  5. String baseUrl = ConfigHelper.instants().getValue("walletServerBaseUrl");
  6. String walletServerUrl = baseUrl + url + instanceId;
  7. // Construct the http body.
  8. String hwLoyaltyInstance = CommonUtil.toJson(body);
  9. JSONObject jsonObj = JSONObject.parseObject(hwLoyaltyInstance);
  10. // Send the http request and get response.
  11. HttpEntity<JSONObject> entity = new HttpEntity<>(jsonObj, header);
  12. ResponseEntity<HwWalletObject> response =
  13. REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.PUT, entity, HwWalletObject.class);
  14. // Return the updated wallet instance.
  15. return response.getBody();
  16. }
在 API参考 中进行搜索
请输入您想要搜索的关键词