| 承载协议 | HTTPS POST |
|---|---|
| 接口方向 | 开发者应用->Health Service Kit云 |
| 接口URL | https://health-api.cloud.huawei.com/healthkit/v2/devices:bind |
| 数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
Request Header
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| Content-type | String | 是 | 取值为:application/json; charset=UTF-8 |
| Authorization | String | 是 | 请参见认证鉴权。 说明: Bearer后面拼接空格,再拼接获取的access_token。 |
| x-client-id | String | 否 | 开放联盟分配的应用标识。服务端可以基于其进行灰度路由,建议携带。 |
| x-version | String | 否 | 接口调用方的软件版本号。即当前客户端版本号,服务端可以基于其进行灰度,建议携带。 |
| x-caller-trace-id | String | 否 | 请求跟踪ID。用于串联服务调用方与服务端整体请求链条,建议携带。 |
Request Body
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| dataTypes | List<String> | 是 | 数据类型。 |
| appInfo | AppInfo | 是 | 数据采集器的应用程序信息。请参见AppInfo数据模型。 |
| deviceInfo | DeviceInfo | 是 | 集成各种传感器的硬件设备描述,例如:手表、手环等可穿戴设备。 请参见DeviceInfo数据模型。 |
POST
https://health-api.cloud.huawei.com/healthkit/v2/devices:bind
Content-Type: application/json
Authorization: Bearer ***
x-client-id: ***
x-version: ***
x-caller-trace-id: ***
{
"dataTypes": [
"com.huawei.instantaneous.blood_glucose"
],
"appInfo": {
"appName": "com.huawei.health.device",
"desc": "com.huawei.health.device",
"appVersion": "v1.0"
},
"deviceInfo": {
"manufacturer": "Huawei",
"modelNum": "mp",
"devType": "Phone",
"uniqueId": "yy1240",
"prodId": "180S",
"version": "1.0"
}
} 状态码为200时:
Response Header
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| Content-Type | String | 是 | 取值为:application/json; charset=UTF-8 |
Response Body
| 参数 | 参数类型 | 是否必选 | 描述 |
|---|---|---|---|
| deviceCode | Long | 是 | 设备绑定时生成的绑定码。 |
| dataCollectors | List<DataCollector> | 否 | 数据采集器列表。 |
HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
{
"deviceCode": 300000000150614960,
"dataCollectors": [
{
"collectorId": "cmF3Omluc3RhbnRhbmVvdXMuYmxvb2RfZ2x1Y29zZQEwMTI3ODUwMTpqEF7rB3uBcGykpv6T2TisfTMhfZAvz1BP2Kcz70d1Sg",
"collectorType": "raw",
"collectorDataType": {
"name": "com.huawei.instantaneous.blood_glucose",
"field": [
{
"name": "level",
"format": "float",
"optional": false
},
{
"name": "measure_time",
"format": "integer",
"optional": false
},
{
"name": "sample_source",
"format": "integer",
"optional": true
}
]
},
"deviceInfo": {
"uniqueId": "yy1240",
"devType": "Phone",
"version": "1.0",
"modelNum": "mp",
"manufacturer": "Huawei",
"prodId": "180S",
"devId": "bcbfcaaf-9f7a-4fc6-89cc-2997d1fe2e35",
"deviceCode": 300000000150614960,
"bindStatus": 3
},
"appInfo": {
"appName": "com.huawei.health.device",
"appVersion": "v1.0",
"desc": "com.huawei.health.device",
"clientId": "300013102"
},
"name": "300000000150614960"
}
]
}