Queries the X.509 certificate of a device.
Limits
- You can only query the X.509 certificate of a device that is deployed in the China (Shanghai) region and uses X.509 certificate authentication.
-
Each Alibaba Cloud account can run a maximum of 10 queries per second (QPS).Note Resource Access Management (RAM) users share the quota of the Alibaba Cloud account.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | QueryDeviceCert |
The operation that you want to perform. Set the value to QueryDeviceCert. |
DeviceName | String | Yes | light |
The name of the device. |
ProductKey | String | Yes | a1BwAGV**** |
The ProductKey of the product to which the device belongs. |
IotInstanceId | String | No | iot_instc_pu****_c*-v64******** |
The instance ID. This parameter is not required for the public instance but required for the enterprise instances. |
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this API operation. For more information about common request parameters, see Common request 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, see Error codes. |
DeviceCertInfo | Struct |
The returned certificate information. |
|
CertSN | String | 636217374433**** |
The ID of the X.509 certificate. |
Certificate | String | tXHf4ezGEHcwdyMwoCDHGBmk9avi**** |
The content of the X.509 certificate. |
PrivateKey | String | CqXL5h5ysRTA4NxjABjj0010fa**** |
The private key of the X.509 certificate. |
Status | Integer | 2 |
The status of the X.509 certificate. Valid values:
|
ErrorMessage | String | A system exception has occurred. |
The error message that is returned if the call fails. |
RequestId | String | E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 |
The globally unique identifier that Alibaba Cloud generated for the request. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDeviceCert
&ProductKey=alRedOt****
&DeviceName=device1
&<common request parameters>
Sample success responses
XML
format
<QueryDeviceCertResponse>
<RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
<Success>true</Success>
<DeviceCertInfo>
<Status>2</Status>
<Certificate>tXHf4ezGEHcwdyMwoCDHGBmk9avi****</Certificate>
<PrivateKey>CqXL5h5ysRTA4NxjABjj0010fa****</PrivateKey>
<CertSN>636217374433****</CertSN>
</DeviceCertInfo>
</QueryDeviceCertResponse>
JSON
format
{
"RequestId":"57b144cf-09fc-4916-a272-a62902d5b207",
"Success": true,
"DeviceCertInfo": {
"Status": 2,
"Certificate": "tXHf4ezGEHcwdyMwoCDHGBmk9avi****",
"PrivateKey": "CqXL5h5ysRTA4NxjABjj0010fa****",
"CertSN": "636217374433****"
}
}
Error codes
For a list of error codes, visit the API Error Center.