This service provides a set of APIs for device provisioning and binding. You can use these APIs to bind users to Bluetooth, GPRS, and Wi-Fi devices, and perform operations for the sub-device onboarding process.
Preparation for network provisioning
Device provisioning
Device binding
Get the list of discovered devices
Description
| Path | Version | Description | Requires user authentication |
| /awss/enrollee/list/get | 1.0.7 | Performs a paged query to get the list of discovered devices. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| pageSize | Integer | Yes | The number of entries per page. The value must be less than or equal to 99. |
| pageNum | Integer | Yes | The page number. The value starts from 1. |
Response parameters
| Parameter | Sub-parameter | Type | Description | |
| totalNum | Integer | The total number of entries. | ||
| items | JSON List | An array of objects. | ||
| gmtCreate | Date | The time when the entry was created. | ||
| gmtModified | Date | The time when the entry was last modified. | ||
| regIotId | String | The iotId of the provisioned device. | ||
| regProductKey | String | The ProductKey of the provisioned device. | ||
| regDeviceName | String | Provisioned device: deviceName | ||
| regProductName | String | The product name of the provisioned device. | ||
| enrolleeIotId | String | The iotId of the device to be provisioned. | ||
| enrolleeProductKey | String | The ProductKey of the device to be provisioned. | ||
| enrolleeDeviceName | String | The DeviceName of the device to be provisioned. | ||
| enrolleeProductName | String | The product name of the device to be provisioned. | ||
| bssid | String | Router BSSID | ||
| ssid | String | Hotspot SSID | ||
| rssi | String | Hotspot RSSI | ||
| type | Integer | The type of the discovering device. 0 indicates a device. 1 indicates a router. | ||
| status | Integer | The provisioning status. 0 indicates the initial state. 1 indicates that the device is being provisioned. |
Examples
- Sample request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "pageSize": 10, "pageNum": 1 } } - Sample success response
{ "code": 200, "data": { "totalNum":12, "items":[ { "gmtCreate":xxx, "gmtModified":xxx, "regIotId":"xxx", "regProductKey":"xxx", "regDeviceName":"xxx", "enrolleeIotId":"xxx", "enrolleeProductKey":"xxx", "enrolleeDeviceName":"xxx", "bssid":"xxx", "ssid":"xxx", "rssi":"xxx", "type":0, "status":1 } ] }, "message": "success" }
Filter the list of locally discovered devices
Description
| Path | Version | Description | Requires user authentication |
| /awss/enrollee/product/filter | 1.0.7 | Filters the list of locally discovered devices to find devices that are not yet bound to a user. The filtering is based on specified rules. Note By default, this API processes only published products. To process products that are under development, set the PRODUCT_SCOPE_ALL parameter in the SDK before you call this API:
| Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotDevices | JSON List | Yes | The list of locally discovered devices. |
The following describes the schema of the iotDevices list.
| Field name | Field type | Required | Description |
| productKey | String | Yes | Product Key |
| deviceName | String | Yes | The device name. |
Response parameters
| Parameter | Type | Description |
| productKey | String | The ProductKey of the product. This is the same as the request parameter. |
| deviceName | String | The device name. This is the same as the request parameter. |
| productName | String | The product name. |
| netType | Integer | The network connection type.
|
| nodeType | Integer | The node type. 0 indicates a device. 1 indicates a gateway. |
| categoryKey | String | The identifier of the product category. |
| categoryName | String | The name of the product category. |
| categoryId | Long | The ID of the product category. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params":{ "iotDevices": [{ "productKey": "a1xxxxm", "deviceName": "xxxxxx" }, { "productKey": "a1xxxxb", "deviceName": "xxxxxx" }] } } - Successful response example
{ "code": 200, "data":[{ "productKey":"a1xxxxm", "deviceName":"xxxxxx", "netType":3, "nodeType":0, "categoryKey":"xxx", "categoryName":"xxx", "categoryId":14 } ], "message": "success" }
Query device certificate information by token
Description
| Path | Version | Description | Requires user authentication |
| /awss/token/check | 1.0.9 | Checks a token. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| token | String | Yes | The token reported by the device. |
| productKey | String | No | The ProductKey of the device. |
| deviceName | String | No | The DeviceName of the device. If you specify this parameter, you must also specify the productKey parameter. |
Response parameters
| Parameter | Type | Description |
| productKey | String | The ProductKey of the device to be provisioned. |
| deviceName | String | The DeviceName of the device to be provisioned. |
| iotId | String | The iotId of the device. |
Examples
- Request example
{ "request": { "iotToken": "109049c80bxxxx62e29a3ba", "apiVer": "1.0.9" }, "id": 1508212818676, "params": { "token":"xxx" }, "version": "1.0" } - Successful response example
{ "code": 200, "data": { "iotId": "xxxx" "productKey": "xxxx", "deviceName": "xxxx" }, "id": "e2d74ffe-308e-xxxx-xxxx-9b44a43eabc9" } - Error response example
{ "code":6608, "id":"4fa207ca-fffd-xxxx-xxxx-e6f7ca6c99c3", "message":"token not found" }
Token-based device attachment
Description
| Path | Version | Description | Requires user authentication |
| /awss/token/user/bind | 1.0.8 | Checks a token and binds the device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| homeId | String | Yes | The home ID. This is the unique identifier of a home. |
| productKey | String | Yes | The ProductKey of the device to be provisioned. |
| deviceName | String | Yes | The DeviceName of the device to be provisioned. |
| token | String | Yes | The token reported by the device. |
Response parameters
| Parameter | Type | Description |
| data | String | The iotId of the provisioned device. |
Examples
- Request example
{ "id":"xxx", "version":"1.0.0", "request":{ "language":"en-US", "appKey":"xxx", "iotToken":"xxx", "apiVer":"1.0.8" }, "params":{ "homeId":"50f5op1556xxxxf2f28104512", "productKey":"xxx", "deviceName":"xxx", "token":"xxx" } } - Successful response example
{ "id":"xxx", "code":200, "message":"success", "data":"xxxxxxxxxxxxx" }
Attaching devices based on a time window
Description
| Path | Version | Description | Requires user authentication |
| /awss/time/window/user/bind | 1.0.8 | Checks and binds a device within a 600-second time window. The time window starts when the device is powered on. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| homeId | String | Yes | The home ID. This is the unique identifier of a home. |
| productKey | String | Yes | The ProductKey of the device to be provisioned. |
| deviceName | String | Yes | The DeviceName of the device to be provisioned. |
Response parameters
| Parameter | Type | Description |
| data | String | The iotId of the provisioned device. |
Examples
- Request example
{ "id":"xxx", "version":"1.0.0", "request":{ "language":"en-US", "appKey":"xxx", "iotToken":"xxx", "apiVer":"1.0.8" }, "params":{ "homeId":"50f5op15xxxxca4f2f28104512", "productKey":"xxx", "deviceName":"xxx" } } - Successful response example
{ "id":"xxx", "code":200, "message":"success", "data":"xxxxxxxxxxxxx" }
Get a key
Description
| Path | Version | Description | Requires user authentication |
| /awss/cipher/get | 1.0.7 | Gets a key. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Subkey | Type | Required | Description |
| deviceInfoForCipher | Yes | A JSON object. | ||
| deviceName | String | Yes | deviceName | |
| productKey | String | Yes | The ProductKey. This parameter is required for non-Bluetooth devices. It is not required for Bluetooth devices. | |
| productId | String | Yes | The hexadecimal string of the ProductKey. This parameter is required for Bluetooth devices. It is not required for non-Bluetooth devices. | |
| cipherType | Integer | Yes | The type of key to generate. For more information, see the description after this table. If this parameter is empty, the default value indicates per-product keys. | |
| random | String | Yes | A random number. This is a 32-byte hexadecimal string. | |
| params | JSON | Yes | Extension parameters. For Bluetooth devices, you must pass the MAC address. For non-Bluetooth devices, pass an empty map. |
The following list describes the valid values for the cipherType parameter.
cipherType=3 Per-product key: Queries the productSecret based on the ProductKey. Key algorithm: sha256(contentByteArray).
contentByteArray=productSecret.getByte()+0x2c+hexToByte(random)
cipherType=4 Per-device key: Queries the deviceSecret based on the ProductKey and DeviceName. Key algorithm: sha256(contentByteArray).
contentByteArray=deviceSecret.getByte()+0x2c+hexToByte(random)
cipherType=6 BLE per-product key: Key algorithm: sha256(contentByteArray).
contentByteArray=productSecret.getByte()+0x2c+hexToByte(mac)+0x2c+hexToByte(random)
cipherType=7 BLE per-device key: Key algorithm: sha256(contentByteArray).
contentByteArray=deviceSecret.getByte()+0x2c+hexToByte(mac)+0x2c+hexToByte(random)
The following list describes the differences between per-product keys and per-device keys.
- Per-product key: The system uses the product key (productSecret) to generate the encryption key for local communication during provisioning. You only need to provide the ProductKey.
- Per-device key: The system uses the device key (deviceSecret) to generate the encryption key for local communication during provisioning. You must provide both the ProductKey and the DeviceName.
Response parameters
| Name | Type | Description |
| secret | Integer | The encryption key for local communication during provisioning. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "deviceInfoForCipher": { "deviceName": "xxxx", "productKey": "xxxx", "productId": "001e7", "cipherType": 3, "random": "00000000000000000000000000000000", "params": { "mac":"xxx" } } } } - Successful response example
{ "code": 200, "data": "xxxx", "message": "success" }
Add a sub-device to a gateway
Description
| Path | Version | Description | Requires user authentication |
| /thing/gateway/permit | 1.0.2 | Allows a gateway to process requests to add sub-devices. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The iotId of the gateway device. |
| productKey | String | Yes | The ProductKey of the sub-device product that is allowed to connect to the gateway. |
| time | Integer | Yes |
|
Response parameters
There are no specific response parameters for this operation.
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "iotId": "xxxxxxxxxxxxxx", "productKey": "xxxxxxxxx", "time": 60 } } - Successful response example
{ "id":"xxx", "code":200, "message":"success", "data":null }
Remove a sub-device from the network topology
Description
| Path | Version | Description | Requires user authentication |
| /thing/topo/remove | 1.0.2 | Removes a sub-device from the network topology. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device IoT ID |
| subIotid | String | Yes | The iotId of the sub-device. |
Response parameters
There are no specific response parameters for this operation.
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "iotId": "xxxxxxxxxxxxxx", "subIotId": "xxxxxxxxx" } } - Successful response example
{ "id":"xxx", "code":200, "message":"success", "data":null }