设备动态注册
使用说明
设备动态注册是指,通过http请求的方式,用产品Code+产品秘钥+设备Code获取设备的证书,完成动态注册。目前只有网关及直连设备具备该功能,子设备暂不支持。
流程
创建产品并打开动态注册按钮 -> 创建该产品下的设备 -> 拿到项目ID+产品Code+产品秘钥+设备Code,通过http发送POST请求 -> 获取设备证书
注意事项
1、使用该接口前,确定设备已提前创建完毕;
2、设备对应产品的动态注册开发已打开;
3、创建的设备并未激活
4、请求url中填写正确的项目ID、产品Code、产品秘钥、设备Code
5、获取的设备证书是json格式的字符串,务必妥善保管获取的设备证书
设备动态注册接口(子设备不支持)
url
POST iot/v1/devices/action/dynamic-register
请求参数
属性 | 参数类型 | 属性说明 |
---|---|---|
projectId | String | 项目ID |
productCode | String | 产品Code |
secertKey | String | 产品秘钥 |
deviceCode | String | 设备Code |
响应参数
属性 | 参数类型 | 属性说明 |
---|---|---|
message | String | 提示信息 |
success | String | 调取接口后是否成功 |
cert | Cert | 证书 |
请求示例
URI:
https://service.cloud.com/regionsvc-cn-north-3/iot/v1/devices/action/dynamic-register
Body:
{
"projectId": "XXXXXX",
"productCode": "XXXXXX",
"secertKey": "XXXXXX",
"deviceCode": "XXXXXX"
}
返回示例
{
"message": "成功",
"success": "true",
"cert": {
"id": "8a48d4b96ae3a7ca016ae3b2d025XXXX",
"code": "iotol9592xu-rctuhf5x-deviceTestGXXXXXX",
"name": "大米",
"projectId": "8a8186c2694bd1db016955c28XXXXXX",
"ownerId": "f679eb23-f74d-477a-a31f-a65XXXXXXX",
"flag": "sdjferjk",
"createdTime": "2019-05-23T07:58:26Z",
"updatedTime": "2019-05-23T07:58:26Z",
"clientKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAu7oCbgbQ9htdByrCTILIA59Ckv6iqHpSJIGfAG80ratN/Ba1\n5L5MMfxx1lG2HsFMAmPxPoI2fgi9+NIMjyqJXV1oMcvJhfTRWJImptcdO3/taMkw\n0HuvR0UzJPHxMlW6p+O4JKpQcXiF9gV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UiXbs6za38kWaTk\nZ6ZHRcwJR7nOG9g+GBWrFD5J6uGc5Xn0GIMJ9SltN46/9g3gBqXP8kZjcjwbPtbM\ndYWSXCa4swRlvrT4euyCoxGbhXLXq/r6lRZ+mHD4YNDRkvS6PnUTbxwuJhCwLgku\nk41N8oZM0X1UigeOxsvkhJSaOl0nKRSOi37Fw3rxMW6ElJsCAwEAAaNvMG0wCQYD\nVR0TBAIwADALBgNVHQ8EBAMCBeAwUwYDVR0RBEwwSocECm4ZcocECm4ZcoIeaW90\nb2w5NTkyeHUtaW90LWVtcS1zZXJ2aWNlLWlugg0xMC4xMTAuMjUuMTE0gg0xMC4x\nMTAuMjUuMTE0MA0GCSqGSIb3DQEBCwUAA4IBAQCdh17wCB/gFy+L5cB3158AwZ4A\n8gZzKYuV6+Ei7fckPNkGYXNqTB5nj3sCFgrq4YVJ5mcT8a8oNoYJOYdJXB4zwm/0\n8mX86DCqrje4bBYKUiZ3y/zGDzxco7f0l4D4JcIKifzwUHPDbcTSwduBk8Fxd8Eb\nKYbteBn6efckEAKiAtOQkKKgk2RY7dTzs/w2FJCDsjh+XVZd7WillY20xwCuZaqx\n+ka4KsUwbrZMpQdl06DSn+OONEkI42VmWX+52P6qiEP3zrVrM+F0PkSqQdsRn8XS\nndosY6blx0z0sE8FJ7+EGc/0PIlsf2HzZJcNPk1A/Iae/qHOEtNQQ5acSFlh\n-----END CERTIFICATE-----\n",
"description": "证书(一机一密)属于设备:rctuhf5x-deviceTestGXXXXXXX",
"status": true
}
}
Cert
名称 | 位置 | 类型 | 是否必须 | 描述 |
---|---|---|---|---|
id | body | UUID | 是 | 设备标签的uuid |
code | body | String | 是 | 证书CODE |
name | body | String | 是 | 证书名称 |
projectId | body | String | 是 | 项目ID |
clientKey | body | String | 是 | 证书Key |
clientCrt | body | String | 是 | 证书Crt |
status | body | Boolean | 是 | 激活状态 |
createdTime | body | Date | 是 | 创建时间 |
updatedTime | body | Date | 是 | 更新时间 |