thing.delete

The thing.delete command is used to delete things.

Things can be deleted by specifying any of the following:

  • A single key to delete one thing.

  • An array of keys to delete multiple things.

  • An array of tags to delete things that have all specified tags.

  • A parameter that deletes things matching a query string.

  • A parameter that deletes all things.

TR50 Request


// Delete by a thing key
{
  "cmd": {
    "command": "thing.delete",
    "params": {
      "key": "mythingkey"
    }
  }
}

// Delete by thing keys
{
  "cmd": {
    "command": "thing.delete",
    "params": {
      "key": ["mythingkey1", "mythingkey2"]
    }
  }
}

// Delete by tag(s)
{
  "cmd": {
    "command": "thing.delete",
    "params": {
      "tag": ["tag1", "tag2"]
    }
  }
}
 
// Delete by query
{
  "cmd": {
    "command": "thing.delete",
    "params": {
      "query": "name:deleteme*"
    }
  }
}

// Delete all things
{
  "cmd": {
    "command": "thing.delete",
    "params": {
      "all": true
    }
  }
}
      

Request Parameters

Name

Type

Required

Description

id

String

 

The id of the thing to delete.

id

Array

 

An array of ids to be deleted.

key

String

 

The key of the thing to delete.

key

Array

 

An array of keys to be deleted.

tag

Array

 

Delete things that have all specified tags.

query

String

 

Delete things that conform to the query criteria. For information about the query syntax, see Searching for Things.

all

Boolean

 

Deletes all things (the value must be true).

TR50 Response

If the command is sent successfully a success message is returned. Otherwise, an error and error message will be returned.


{
  "cmd": {
    "success": true
  }
}