SetThingProperties
Updated at:
Copy as MD
Sets the properties for a specified device.
Request syntax
POST /2020-04-30/things/ProductKey/DeviceName/properties HTTP/1.1
Cookie: Cookie
PayloadImportant
2020-04-30 is the version number of the edge OpenAPI. This value cannot be changed.Request parameters
| Parameter | Type | Required | Description |
| ProductKey | String | Yes | The unique identifier of the product to which the device belongs. You can obtain this identifier from the IoT Platform console. |
| DeviceName | String | Yes | The name of the device. You can obtain this name from the IoT Platform console. |
| Cookie | String | Yes | The authentication cookie. Call the CreateAuthCookie operation to create the cookie. |
| Payload | JSON | Yes | The properties to set for the device. For the format, see the request payload format below this table. |
The request payload is in the following format.
{
"Properties": {
"Identifier1": value1,
"Identifier2": value2,
"Identifier3": value3,
...
}
}Response syntax
HTTP/1.1 StatusCode
Content-Type: application/json
PayloadResponse parameters
| Parameter | Type | Description |
| StatusCode | Number | The HTTP status code. A value of 200 indicates that the request was successful. Other values indicate that the request failed. For more information about status codes, see Status codes. |
| Payload | JSON | The content that is returned by the underlying property setting layer. |
The response payload is in the following format.
{
"Data": {
"Data": string|boolean|number|array|object, // Optional. The data returned from the underlying set operation.
"Timestamp": 1568262117344
}
}Complete example
curl -i -b token.cookie -d '{"Properties":{"LightSwitch":0}}' -k -X POST https://127.0.0.1:9999/2020-04-30/things/a1W****CGHU/N0hB9tiVWWZF****KHgs/properties
HTTP/1.1 200 OK
Server: openresty/1.13.6.2
Date: Wed, 22 Apr 2020 17:06:07 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
{"Data":{"Data":[],"Timestamp":1587575167259}}Is this page helpful?