All Products
Search
Document Center

IoT Platform:DeleteDevice

更新時間:Sep 15, 2023

Deletes a device. If you call this operation to delete a gateway, the topological relationships between the gateway and the sub-devices that are connected to the gateway are also deleted.

Usage notes

Before you call this operation

If you want to call this operation as a Resource Access Management (RAM) user, you can create custom permission policies to grant fine-grained permissions to the RAM user. This ensures device security. For more information, see Mapping between IoT Platform API operations and RAM policies and Custom permissions.

Warning
  • After a device is deleted, the device ID (IotId) becomes invalid, and all other information associated with the device is deleted. In addition, you can no longer perform an operation on the device.

  • Before you delete a device in the IoT Platform console, make sure that the real device is offline. Otherwise, the real device continuously initiates connection requests to IoT Platform after the device is deleted from IoT Platform. When the number of requests exceeds the upper limit, IoT Platform throttles requests. In this case, other devices within your Alibaba Cloud account may fail to connect to IoT Platform.

  • After you delete a device, the certificate of the device becomes invalid and cannot be restored. Proceed with caution.

When you call this operation

  • You must specify the IotId or the ProductKey and DeviceName to specify a device.

  • If you call this operation to delete a gateway to which more than 2,000 sub-devices are connected, this operation creates an asynchronous device job to delete the topological relationships. This operation returns the JobId of the asynchronous job.

QPS limits

You can call this operation up to 50 times per second per account.

Note

The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

DeleteDevice

The operation that you want to perform. Set the value to DeleteDevice.

IotInstanceId

String

No

iot-cn-0pp1n8t****

The instance ID. You can view the instance ID on the Overview tab of the IoT Platform console.

Important
  • You must specify this parameter if your instance has an ID. Otherwise, the request fails.

  • If the Overview tab or instance ID is not displayed in the IoT Platform console, you do not need to specify this parameter.

For more information about instances, see Overview.

ProductKey

String

No

a1FlqIQ****

The ProductKey of the product to which the device belongs.

Important

If you specify this parameter, you must also specify the DeviceName.

DeviceName

String

No

light

The name of the device that you want to delete.

Important

If you specify this parameter, you must also specify the ProductKey.

IotId

String

No

MpEKNuEUJzIORNANAWJX0010929900*****

The ID of the device that you want to delete.

Important

An IotId specifies the GUID of a device. The IotId corresponds to the combination of the ProductKey and DeviceName. If you specify this parameter, you do not need to specify the ProductKey or DeviceName. If you specify the IotId, ProductKey, and DeviceName at the same time, the IotId takes precedence.

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.prod.NullProductKey

The error code that is returned if the request failed. For more information about error codes, see Error codes.

ErrorMessage

String

The product ID is invalid.

The error message that is returned if the request failed.

RequestId

String

57b144cf-09fc-4916-a272-a62902d5b207

The request ID.

Success

Boolean

false

Indicates whether the request was successful. Valid values:

  • true

  • false

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=DeleteDevice
&ProductKey=a1rYuVF****
&DeviceName=device1
&<Common request parameters>

Sample success responses

XML format

<DeleteDeviceResponse>
  <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
  <Success>true</Success>
</DeleteDeviceResponse>

JSON format

{
  "RequestId":"57b144cf-09fc-4916-a272-a62902d5b207",
  "Success": true
}

Error codes

For a list of error codes, see Service error codes.