Sets properties of a specified device.

Request syntax

POST /2019-09-30/things/ProductKey/DeviceName/services HTTP/1.1
Cookie: Cookie

Payload

Request Parameters

Parameter Type Required Description
ProductKey String Yes The unique identifier of product to which the device belongs. You can obtain the value of this parameter from the IoT Platform console.
DeviceName String Yes The name of the device. You can obtain the value of this parameter from the IoT Platform console.
Cookie String Yes The authentication cookie generated when the CreateAuthCookie API operation is called.
Payload JSON Yes Sets device properties. For more information, see the request Payload format.

The format of the request Payload is as follows:

{
  "Properties": {
    "Identifier1": value1,
    "Identifier2": value2,
    "Identifier3": value3
      ...
  }
}

Response syntax

HTTP/1.1 StatusCode
Content-Type: application/json

Payload

Response Parameters

Parameter Type Description
StatusCode Number The HTTP status code. If the request is successful, 200 is returned. If the request fails, other status codes are returned. For information, see Status codes.
Payload JSON Sets the content returned by the interface.

The format of the returned Payload is as follows:

{
  "Code": 200,
  "Message": "sucess|reason for failure",
  "Data": {
    "Data": string|boolean|number|array|object, // A optional data that returned from the underlying set
    "Timestamp": 1568262117344
  }
}

Example

$ curl -b token.cookie -d '{"Properties":{"LightSwitch":0}}' -k -X POST https://127.0.0.1:9999/2019-09-30/things/a1WabAEC***/N0hB9tiVWWZFMpALK***/properties

{"Data":{"Data":[],"Timestamp":1572512468781},"Code":200,"Message":"success"}