Get Attributes¶
A device can publish a message to this topic to retrieve the attributes from the cloud.
Upstream
Request TOPIC:
/sys/{productKey}/{deviceKey}/thing/attribute/queryReply TOPIC:
/sys/{productKey}/{deviceKey}/thing/attribute/query_reply
Sample Request Format¶
{
 "id": "123",
 "version": "1.0",
 "params": {
   "attributes": ["attr1", "attr2", "attr3"]
 },
 "method": "thing.attribute.query"
}
Sample Response Format¶
{
 "id": "123",
 "code": 200,
 "data": {
   "attr1": {
       "value": 1.0,
       "value2": "9"
     },
   "attr2": 1.02,
   "attr3": [1.02, 2.02, 7.93]
 }
}
Request Parameter Description¶
Parameter  | 
Type  | 
Mandatory/Optional  | 
Description  | 
|---|---|---|---|
id  | 
Long  | 
Optional  | 
The message ID. It is a reserved parameter that is reserved for future use.  | 
version  | 
String  | 
Mandatory  | 
The version of the protocol. The current version is 1.0.  | 
params  | 
List  | 
Mandatory  | 
The parameters used for getting the attributes.  | 
attributes  | 
Array  | 
Mandatory  | 
The list of the device’s attributes’ identifiers. A request can carry a maximum of 200 items. When not specified, the system will retrieve all the attributes.  | 
method  | 
String  | 
Mandatory  | 
The request method.  | 
Response Parameter Description¶
Parameter  | 
Type  | 
Mandatory/Optional  | 
Description  | 
|---|---|---|---|
code  | 
Integer  | 
Mandatory  | 
The return code. “200” indicates that the request operation is executed successfully.  | 
data  | 
Struct  | 
Mandatory  | 
The returned information of the attributes.  | 
Return Code¶
Return Code  | 
Error Message  | 
Explanation  | 
|---|---|---|
1208  | 
Attribute query data format error  | 
Invalid request format.  |