This topic describes the topics and Alink JSON formats that are used in the following scenarios: Devices request configuration information from IoT Platform and IoT Platform pushes configuration information to devices.
For more information about how to use the remote configuration feature, see Remote configuration in the user guide.
Devices request configuration information from IoT Platform
The following topics are used when a device sends requests to IoT Platform and IoT Platform sends responses to the device:
- Request topic:
/sys/${productKey}/${deviceName}/thing/config/get
- Response topic:
/sys/${productKey}/${deviceName}/thing/config/get_reply
Sample request in the Alink JSON format:
{
"id": 123,
"version": "1.0",
"sys":{
"ack":0
},
"params": {
"configScope": "product",
"getType": "file"
},
"method": "thing.config.get"
}
Sample response in the Alink JSON format:
{
"id": "123",
"version": "1.0",
"code": 200,
"data": {
"configId": "123dagdah",
"configSize": 1234565,
"sign": "123214adfadgadg",
"signMethod": "Sha256",
"url": "https://iotx-config.oss-cn-shanghai.aliyuncs.com/nopoll_0.4.4.tar.gz?Expires=1502955804&OSSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Signature=XfgJu7P6DWWejstKJgXJEH0qAKU%3D&security-token=CAISuQJ1q6Ft5B2yfSjIpK6MGsyN1Jx5jo6mVnfBglIPTvlvt5D50Tz2IHtIf3NpAusdsv03nWxT7v4flqFyTINVAEvYZJOPKGrGR0DzDbDasumZsJbo4f%2FMQBqEaXPS2MvVfJ%2BzLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fr6%2F5gdc9FcQSkL0B8ZrFsKxBltdUROFbIKP%2BpKWSKuGfLC1dysQcO1wEP4K%2BkkMqH8Uic3h%2Boy%2BgJt8H2PpHhd9NhXuV2WMzn2%2FdtJOiTknxR7ARasaBqhelc4zqA%2FPPlWgAKvkXba7aIoo01fV4jN5JXQfAU8KLO8tRjofHWmojNzBJAAPpYSSy3Rvr7m5efQrrybY1lLO6iZy%2BVio2VSZDxshI5Z3McKARWct06MWV9ABA2TTXXOi40BOxuq%2B3JGoABXC54TOlo7%2F1wTLTsCUqzzeIiXVOK8CfNOkfTucMGHkeYeCdFkm%2FkADhXAnrnGf5a4FbmKMQph2cKsr8y8UfWLC6IzvJsClXTnbJBMeuWIqo5zIynS1pm7gf%2F9N3hVc6%2BEeIk0xfl2tycsUpbL2FoaGk6BAF8hWSWYUXsv59d5Uk%3D",
"getType": "file"
}
}
The following table describes the parameters.
Parameter | Type | Description |
---|---|---|
id | String | The ID of the message. Valid values: 0 to 4294967295. Each message ID must be unique for the device. |
version | String | The version of the protocol. Valid value: 1.0. |
sys | Object | The parameter for extended features. The value contains the fields for each feature. Note If no extended features are configured when you use a device SDK to develop device features, this parameter is unavailable. The extended features use the default configurations. |
ack | Integer | The extended feature field in the sys parameter. This field specifies whether IoT Platform needs to return response data for the registration request. Valid values:
Important For more information about the parameter, see Examples on how to use a TSL model. If the feature is not configured, this parameter is unavailable. By default, IoT Platform returns response data for a registration request. |
configScope | String | The configuration scope. IoT Platform supports only product-level configurations. Valid value: product. |
getType | String | The format in which the configurations are returned. IoT Platform supports the file format. Valid value: file. |
method | String | The request method. Valid value: thing.config.get. |
configId | String | The ID of the configuration file. |
configSize | Long | The size of the configuration file, in bytes. |
sign | String | The signature. |
signMethod | String | The signing method. IoT Platform supports only SHA-256. |
url | String | The URL of the configuration file that is stored in Object Storage Service (OSS). |
code | Integer | The HTTP status code in the response. If 200 is returned, the request was successful. If other status codes are returned, the request failed. For more information, see Common codes on devices. |
The following table describes the error codes.
HTTP status code | Error message | Description |
---|---|---|
6713 | thing config function is not available | The error message returned because the remote configuration feature is disabled for the product. To resolve this issue, perform the following steps: Log on to the IoT Platform console.In the left-side navigation pane, choose . Then, enable the remote configuration feature for the product. |
6710 | no data | The error message returned because no configuration data is available. |
IoT Platform pushes configuration information to devices
The following topics are used when IoT Platform sends requests to a device and the device sends responses to IoT Platform:
- Request topic:
/sys/${productKey}/${deviceName}/thing/config/push
- Response topic:
/sys/${productKey}/${deviceName}/thing/config/push_reply
After you configure configuration push for multiple devices in the IoT Platform console, IoT Platform asynchronously pushes the configuration information to the devices that subscribe to the configuration push topic.
Sample request in the Alink JSON format:
{
"id": "123",
"version": "1.0",
"params": {
"configId": "123dagdah",
"configSize": 1234565,
"sign": "123214adfadgadg",
"signMethod": "Sha256",
"url": "https://iotx-config.oss-cn-shanghai.aliyuncs.com/nopoll_0.4.4.tar.gz?Expires=1502955804&OSSAccessKeyId=XXXXXXXXXXXXXXXXXXXX&Signature=XfgJu7P6DWWejstKJgXJEH0qAKU%3D&security-token=CAISuQJ1q6Ft5B2yfSjIpK6MGsyN1Jx5jo6mVnfBglIPTvlvt5D50Tz2IHtIf3NpAusdsv03nWxT7v4flqFyTINVAEvYZJOPKGrGR0DzDbDasumZsJbo4f%2FMQBqEaXPS2MvVfJ%2BzLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fr6%2F5gdc9FcQSkL0B8ZrFsKxBltdUROFbIKP%2BpKWSKuGfLC1dysQcO1wEP4K%2BkkMqH8Uic3h%2Boy%2BgJt8H2PpHhd9NhXuV2WMzn2%2FdtJOiTknxR7ARasaBqhelc4zqA%2FPPlWgAKvkXba7aIoo01fV4jN5JXQfAU8KLO8tRjofHWmojNzBJAAPpYSSy3Rvr7m5efQrrybY1lLO6iZy%2BVio2VSZDxshI5Z3McKARWct06MWV9ABA2TTXXOi40BOxuq%2B3JGoABXC54TOlo7%2F1wTLTsCUqzzeIiXVOK8CfNOkfTucMGHkeYeCdFkm%2FkADhXAnrnGf5a4FbmKMQph2cKsr8y8UfWLC6IzvJsClXTnbJBMeuWIqo5zIynS1pm7gf%2F9N3hVc6%2BEeIk0xfl2tycsUpbL2FoaGk6BAF8hWSWYUXsv59d5Uk%3D",
"getType": "file"
},
"method": "thing.config.push"
}
Sample response in the Alink JSON format:
{
"id": "123",
"code": 200,
"data": {}
}
The following table describes the parameters.
Parameter | Type | Description |
---|---|---|
id | String | The ID of the message. Valid values: 0 to 4294967295. Each message ID must be unique for the device. |
version | String | The version of the protocol. Valid value: 1.0. |
configScope | String | The configuration scope. IoT Platform supports only product-level configurations. Valid value: product. |
getType | String | The format in which the configurations are returned. IoT Platform supports the file format. Valid value: file. |
configId | String | The ID of the configuration file. |
configSize | Long | The size of the configuration file, in bytes. |
sign | String | The signature. |
signMethod | String | The signing method. IoT Platform supports only SHA-256. |
url | String | The URL of the configuration file that is stored in OSS. |
method | String | The request method. Valid value: thing.config.push. |
code | Integer | The HTTP status code in the response. For more information, see Common codes on devices. |
You can use the rules engine of IoT Platform to forward responses from a device to other topics or other Alibaba Cloud services. For more information about how to use the data forwarding feature, see Configure data forwarding rules. For more information about the device response topic and data formats, see the "Submit responses to downstream requests" section of the Data formats topic.