Revoke Certificate¶
Revoke the certificate bound to a device.
Operation Permissions¶
Required Authorization |
Required Operation Permission |
---|---|
Device Management |
Full Access |
Request Format¶
POST http://{apigw-address}/connect-service/v2.0/certificates?action=revoke
Request Parameters (URI)¶
Note
One of the following options must be included in a request to specify a device.
assetId
productKey
+deviceKey
Name |
Location (Path/Query) |
Required or Not |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
True |
String |
OU ID |
assetId |
Query |
False |
String |
Asset ID |
productKey |
Query |
False |
String |
Product key of the device |
deviceKey |
Query |
False |
String |
Device key of the device |
certSn |
Query |
True |
Int |
The number of the certificate to be revoked |
reason |
Query |
False |
RevokeReason |
|
Response Parameters¶
Name |
Required or Not |
Description |
---|---|---|
data |
null |
Samples¶
Java SDK Sample¶
package com.envisioniot.enos.api.sample.connect_service.cert;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.connect_service.v2_1.cert.RevokeCertificateRequest;
import com.envisioniot.enos.connect_service.v2_1.cert.RevokeCertificatesResponse;
import com.envisioniot.enos.connect_service.v2_1.cert.RevokeReason;
import com.envisioniot.enos.connect_service.vo.DeviceIdentifier;
public class RevorkCert {
public static void main(String[] args) {
String appKey = "e36cc693-3a07-456e6cafcbc2-9314-4ff6";
String appSecret = "6cafcbc2-9314-4ff6-9450-861d4344a431";
String serverUrl = "http://apim-apigw-proxy.alpha-k8s-cn4.eniot.io";
String orgId = "o15444172373271";
Integer certSn = 2661;
RevokeCertificateRequest request = new RevokeCertificateRequest();
DeviceIdentifier identifier = new DeviceIdentifier();
identifier.setProductKey("ymcDiAHd");
identifier.setAssetId("KloXinjW");
identifier.setDeviceKey("TT6MyEFaO7");
request.setDevice(identifier);
request.setCertSn(certSn);
request.setOrgId(orgId);
request.setReason(RevokeReason.UNSPECIFIED);
RevokeCertificatesResponse certRsp = Poseidon.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
.url(serverUrl)
.getResponse(request, RevokeCertificatesResponse.class);
if (certRsp.success()) {
System.out.println("revoke is success!");
}
}
}
Error Code¶
Error Code |
Type |
Description |
---|---|---|
99400 |
|
|
11404 |
device can not be found |
No device can be specified by |
99500 |
|
|