Query Device Properties
Function
A product model defines properties that the platform can deliver to devices. This API is used by an application to query real-time properties of a device. The device returns the query result to the application. This API can only be used for MQTT devices. NB-IoT devices are not supported.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v5/iot/{project_id}/devices/{device_id}/properties
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
device_id |
Yes |
String |
Parameter description: ID of the device to which the property is delivered. The ID is unique and is allocated by the platform during device registration. Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
project_id |
Yes |
String |
Parameter description: project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
service_id |
Yes |
String |
Parameter description: device service ID, which is defined in the product model associated with the device. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. In the returned response header, X-Subject-Token is the desired user token. For details about how to obtain the token, see Token Authentication. |
Instance-Id |
No |
String |
Parameter description: instance ID. This parameter is required only when the API is called from the management plane in the physical multi-tenant scenario. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
response |
Object |
Property execution result reported by the device. The value is in JSON format. The specific format depends on the application and device. |
Example Requests
GET https://{endpoint}/v5/iot/{project_id}/devices/{device_id}/properties
Example Responses
Status code: 200
OK
{ "response" : { "services" : { "serviceId" : "Temperature", "properties" : { "PhV_phsA" : "1", "PhV_phsB" : "2" }, "eventTime" : "20190606T121212Z" } } }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
503 |
Service Unavailable |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackFor any further questions, feel free to contact us through the chatbot.
Chatbot