合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
HMS Core
根据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”。 |
- GET /hmspass/v1/eventticket/model/eventticketModelTest 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
- HTTP/1.1 200 OK
- Content-Type: application/json
- {
- "passVersion": "1.0",
- "passTypeIdentifier": "hwpass.com.huawei.wallet.eventticket.test",
- "passStyleIdentifier": "eventTicketModelTest",
- "organizationName": "Huawei",
- "fields": {
- "countryCode": "CN",
- "locationList": [
- {
- "longitude": "114.0679603815",
- "latitude": "22.6592051284"
- }
- ],
- "commonFields": [
- {
- "key": "logo",
- "value": "https://www.huawei.com/XXX.png"
- },
- {
- "key": "name",
- "value": "XXX Party Ticket"
- },
- {
- "key": "merchantName",
- "value": "Huawei",
- "localizedValue": "merchantNameI18N"
- },
- {
- "key": "address",
- "value": "XXX location"
- },
- {
- "key": "ticketType",
- "value": "Adult ticket"
- }
- ],
- "appendFields": [
- {
- "key": "backgroundColor",
- "value": "#FF1C2635"
- }
- ],
- "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"
- }
- ],
- "messageList": [
- {
- "key": "message[0]",
- "value": "Welcome to the party!"
- }
- ],
- "timeList": [
- {
- "key": "startTime",
- "value": "2020-01-22T09:20:00.083Z"
- },
- {
- "key": "endTime",
- "value": "2020-01-22T12:20:00.083Z"
- }
- ],
- "localized": [
- {
- "key": "merchantNameI18N",
- "language": "zh-cn",
- "value": "华为"
- },
- {
- "key": "merchantNameI18N",
- "language": "en",
- "value": "Huawei"
- }
- ]
- }
- }
详见错误码。
- public HwWalletObject getWalletModelByModelId(String url, String modelId) {
- // Construct the http header.
- HttpHeaders header = constructHttpHeaders();
- // Construct the http URL.
- String baseUrl = ConfigHelper.instants().getValue("walletServerBaseUrl");
- String walletServerUrl = baseUrl + url + modelId;
-
- // Send the http request and get response.
- ResponseEntity<HwWalletObject> response =
- REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.GET, new HttpEntity(header), HwWalletObject.class);
-
- // Return the wallet model with the corresponding model ID.
- return response.getBody();
- }
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功