目录

设备绑定状态校验

功能介绍

南向设备接入,设备绑定前校验设备的绑定状态。

场景描述

南向设备接入,设备绑定前校验设备的绑定状态。南向GPRS设备接入生态应用场景请参见GPRS设备章节。

使用约束

接口原型

承载协议

HTTPS POST

接口方向

开发者应用->Health Service Kit云

接口URL

https://health-api.cloud.huawei.com/healthkit/v2/devices:bindStatusCheck

数据格式

请求消息: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

参数

参数类型

是否必选

描述

参数范围

prodId

String

是

WiseDevice的设备ID。

长度范围:1-6。

uniqueId

String

是

设备标识,设备注册时携带的udid或sn。

长度范围:1-128。

请求示例

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: ***
{
    "prodId": "180S",
    "uniqueId": "yy1240"
}

响应参数

状态码为200时:

Response Header

参数

参数类型

是否必选

描述

Content-Type

String

是

取值为:application/json; charset=UTF-8

Response Body

参数

参数类型

是否必选

描述

备注

bindStatusCode

Integer

是

设备绑定状态。

设备绑定状态:

  • 1:设备未绑定
  • 2:设备非本人绑定(冲突)
  • 3:设备本人绑定

deviceBindResp

DeviceBindResp

否

设备绑定状态响应。请参见DeviceBindResp数据模型。

说明:

只有当bindStatusCode取值为3,deviceBindResp才会返回数据采集器相关信息。

响应示例

HTTP/1.1 200 OK
Content-type: application/json;charset=utf-8
{
    "bindStatusCode": 3,
    "deviceBindResp": {
        "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",
                "lastUpdateTime": 0
            }
        ]
    }
}

错误码

请参见错误码。