GetThingProperties

Updated at:

Obtains the values of properties for a specified device.

Request syntax

GET /2020-04-30/things/ProductKey/DeviceName/properties?identifiers=Identifier1&identifiers=Identifier2&... HTTP/1.1
Cookie: Cookie
Important 2020-04-30 is the version number of the edge OpenAPI. This value cannot be changed.

Request parameters

ParameterTypeRequiredDescription
ProductKeyStringYesThe unique identifier of product to which the device belongs. You can obtain the value of this parameter from the IoT Platform console.
DeviceNameStringYesThe DeviceName of the device. You can obtain the value of this parameter from the IoT Platform console.
IdentifiersStringYesThe identifiers for the properties of the device. You can query up to 100 property values.
CookieStringYesThe authentication cookie that is generated when you call the CreateAuthCookie operation.

Response syntax

HTTP/1.1 StatusCode
Content-Type: application/json

Payload

Response parameters

ParameterTypeDescription
StatusCodeNumberThe response code. The status code 200 indicates that the request was successful. Other status codes indicate that the request failed. For more information, see Status codes.
PayloadJSONThe values of device properties that you queried.

Sample success response

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

Complete sample code

$ curl -i -b token.cookie -k https://127.0.0.1:9999/2020-04-30/things/a1W****CGHU/N0hB9tiVWWZF****KHgs/properties?identifiers=LightSwitch

HTTP/1.1 200 OK
Server: openresty/1.13.6.2
Date: Wed, 22 Apr 2020 17:01:50 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive

{"Data":{"Timestamp":1587574910136,"Properties":{"LightSwitch":1}}}