| 承载协议 | HTTPS POST |
|---|---|
| 接口方向 | 开发者应用->Health Service Kit云 |
| 接口URL | https://health-api.cloud.huawei.com/healthkit/v2/trainingplan/events |
| 数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
Request Header
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| Content-type | String | 是 | 取值为:application/json |
| Authorization | String | 是 | 请参见认证鉴权。 说明: Bearer后面拼接空格,再拼接获取的access_token,以及需要有“https://www.huawei.com/healthkit/healthplan.write”权限信息。 |
| x-client-id | String | 否 | 开放联盟分配的应用标识。服务端可以基于其进行灰度路由,建议携带。 |
| x-version | String | 否 | 接口调用方的软件版本号。即当前客户端版本号,服务端可以基于其进行灰度,建议携带。 |
| x-caller-trace-id | String | 否 | 请求跟踪ID。用于串联服务调用方与服务端整体请求链条,建议携带。 |
Request Body
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| event | 是 | 赛事详情。 |
POST
https://health-api.cloud.huawei.com/healthkit/v2/trainingplan/events
Content-Type: application/json
Authorization: Bearer ***
x-client-id: ***
x-version: ***
x-caller-trace-id: ***
{
"name": "南京马拉松",
"timeZone": "+0800",
"holdingTime": 1772995542708,
"city": "南京",
"type": 0,
"subType": 0,
"totalDistance": 50,
"userChosenGroupType": 1,
"userChosenDistance": 42.195,
"appInfo": {
"appName": "数字心动",
"appVersion": "1.0.0.0",
"desc": "数字心动导入的数据"
}
} 状态码为200时:
Response Header
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 取值为:application/json; charset=UTF-8 |
Response Body
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| result | 是 | 赛事详情。 |
HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
{
"result": {
"eventId": "142736",
"name": "南京马拉松",
"holdingTime": 1773081780354,
"timeZone": "+0800",
"city": "南京",
"type": 0,
"subType": 0,
"totalDistance": 50.0,
"userChosenGroupType": 1,
"userChosenDistance": 42.195,
"createTime": 1772476980416,
"modifyTime": 1772476980416,
"appInfo": {
"appName": "数字心动",
"appVersion": "1.0.0.0",
"desc": "数字心动导入的数据"
}
}
}