The "deleteThings" action permanently deletes one or more things by ID or by "thingName". The "delete" action permanently removes a record. It cannot be undone. It removes all links to other items, including links to labels, inputs, outputs, tags, etc.
Instead of permanently deleting a thing, you can run the "alterThing" action and set a thing's "status" property to "inactive". An inactive thing retains all its properties and links to other items. It is easy to restore an inactive thing by running the "alterThing" action and setting its status to "active".
Request examples
Minimal
{
"action": "deleteThings",
"params": {
"ids": [ 1, "2" ]
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "hub",
"action": "deleteThings",
"params": {
"thingNames": [ "My Device", "Changed Name" ]
},
"responseOptions": {
"binaryFormat": "hex",
"numberFormat": "string",
"variantFormat": "variantObject"
},
"authToken": "replaceWithAuthTokenFromCreateSession",
"requestId": "1",
"debug": "none"
}
Response examples
Minimal
{
"authToken": "replaceWithAuthTokenFromCreateSession",
"result": {
"deletedThings": [
{
"id": 1,
"thingName": "My Device",
//...use the values for "My Device" in the response to describeThings...
},
{
"id": 2,
"thingName": "My Device #2",
//...use the values for "Changed Name" in the response to describeThings...
}
]
},
"errorCode": 0,
"errorMessage": ""
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
thingNames |
The "thingNames" property specifies one or more thing names. Each item in the array is the exact name of a thing. You can use it to describe or delete things. |
Required - No default value | array | one or more thing name strings |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
deletedThings |
The "deletedThings" property lists the id and thingName of the things that were successfully deleted. |
array of objects | No limit |
|
deletedThings .id |
The |
integer |
|
|
deletedThings .thingName |
The "thingName" property specifies the unique name of a thing. |
string | 1 to 64 bytes |