管理中心
我的
API参考钱包服务REST开发者调用接口卡券创建、查询、修改接口活动门票接口单个查询活动门票模板

单个查询活动门票模板

功能介绍

根据modelId获取对应的活动门票模板。

场景描述

开发者可以调用该API,查看某一个已添加到华为钱包服务器的活动门票模板。

使用约束

需在华为AGC网站上创建应用并申请卡券对应的服务。

接口原型

承载协议

HTTPS GET

接口方向

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

接口URL

{url}/hmspass/v1/eventticket/model/{modelId}

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

数据格式

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

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

路径参数

展开

参数

是否必选

参数类型

描述

modelId

是

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”。

请求示例

收起
自动换行
深色代码主题
复制
  1. GET /hmspass/v1/eventticket/model/eventticketModelTest 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

响应参数

错误码为200时:

展开

参数

参数类型

描述

详见HwWalletObject参数描述

HwWalletObject

modelId对应的卡券模板

响应示例

收起
自动换行
深色代码主题
复制
  1. HTTP/1.1 200 OK
  2. Content-Type: application/json
  3. {
  4. "passVersion": "1.0",
  5. "passTypeIdentifier": "hwpass.com.huawei.wallet.eventticket.test",
  6. "passStyleIdentifier": "eventTicketModelTest",
  7. "organizationName": "Huawei",
  8. "fields": {
  9. "countryCode": "CN",
  10. "locationList": [
  11. {
  12. "longitude": "114.0679603815",
  13. "latitude": "22.6592051284"
  14. }
  15. ],
  16. "commonFields": [
  17. {
  18. "key": "logo",
  19. "value": "https://www.huawei.com/XXX.png"
  20. },
  21. {
  22. "key": "name",
  23. "value": "XXX Party Ticket"
  24. },
  25. {
  26. "key": "merchantName",
  27. "value": "Huawei",
  28. "localizedValue": "merchantNameI18N"
  29. },
  30. {
  31. "key": "address",
  32. "value": "XXX location"
  33. },
  34. {
  35. "key": "ticketType",
  36. "value": "Adult ticket"
  37. }
  38. ],
  39. "appendFields": [
  40. {
  41. "key": "backgroundColor",
  42. "value": "#FF1C2635"
  43. }
  44. ],
  45. "imageList": [
  46. {
  47. "key": "mainImage[0]",
  48. "value": "https://www.huawei.com/XXX0.png"
  49. },
  50. {
  51. "key": "mainImage[1]",
  52. "value": "https://www.huawei.com/XXX1.png"
  53. },
  54. {
  55. "key": "mainImage[2]",
  56. "value": "https://www.huawei.com/XXX2.png"
  57. }
  58. ],
  59. "messageList": [
  60. {
  61. "key": "message[0]",
  62. "value": "Welcome to the party!"
  63. }
  64. ],
  65. "timeList": [
  66. {
  67. "key": "startTime",
  68. "value": "2020-01-22T09:20:00.083Z"
  69. },
  70. {
  71. "key": "endTime",
  72. "value": "2020-01-22T12:20:00.083Z"
  73. }
  74. ],
  75. "localized": [
  76. {
  77. "key": "merchantNameI18N",
  78. "language": "zh-cn",
  79. "value": "华为"
  80. },
  81. {
  82. "key": "merchantNameI18N",
  83. "language": "en",
  84. "value": "Huawei"
  85. }
  86. ]
  87. }
  88. }

错误码

详见错误码。

调用示例

收起
自动换行
深色代码主题
复制
  1. public HwWalletObject getWalletModelByModelId(String url, String modelId) {
  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 + modelId;
  7. // Send the http request and get response.
  8. ResponseEntity<HwWalletObject> response =
  9. REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.GET, new HttpEntity(header), HwWalletObject.class);
  10. // Return the wallet model with the corresponding model ID.
  11. return response.getBody();
  12. }