Queries the shadow information of a specific device.
QPS limits
You can call this API operation up to 500 times per second per account.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | No | GetDeviceShadow | The operation that you want to perform. Set the value to GetDeviceShadow. |
DeviceName | String | No | device1 | The DeviceName of the device. |
ProductKey | String | No | a1T27vz**** | The ProductKey of the product to which the device belongs. |
IotInstanceId | String | No | iot_instc_pu****_c*-v64******** | The ID of the instance. You can view the ID of the instance on the Overview page in the IoT Platform console. Important
For more information, see Overview. |
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | iot.system.SystemException | The error code that is returned if the call fails. For more information about error codes, see Error codes. |
ErrorMessage | String | A system exception occurred. | The error message that is returned if the call fails. |
RequestId | String | A56E345A-0978-4993-ACBA-3EF444ED187F | The ID of the request. |
ShadowMessage | String | {"method":"update","state":{"desired":{"color":"green"}},"version":1} | The shadow information that is returned if the call is successful. Note The structure of the shadow information varies based on the status of the device. For more information, see the Overview topic of Device shadows. |
Success | Boolean | true | Indicates whether the call was successful. Valid values:
|
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=GetDeviceShadow
&ProductKey=a1T27vz****
&DeviceName=device1
&<Common request parameters>
Sample success response
XML
format
<GetDeviceShadowResponse>
<RequestId>A56E345A-0978-4993-ACBA-3EF444ED187F</RequestId>
<ShadowMessage>{"method":"update","state":{"desired":{"color":"green"}},"version":1}</ShadowMessage>
<Success>true</Success>
</GetDeviceShadowResponse>
JSON
format
{
"RequestId": "A56E345A-0978-4993-ACBA-3EF444ED187F",
"ShadowMessage": "{\"method\":\"update\",\"state\":{\"desired\":{\"color\":\"green\"}},\"version\":1}",
"Success": true
}