Custom tags API - DELETE tags

Deletes the specified custom tag from the specified monitored entities.

The request produces an application/json payload.

Early Adopter

This request is an Early Adopter release and may be changed in non-compatible way.

DELETE
  • Managed https://{your-domain}/e/{your-environment-id}/api/v2/tags
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/v2/tags

Authentication

To execute this request, you need the Write entities using API V2 (entities.write) permission assigned to your API token. To learn how to obtain and use it, see Authentication.

Parameters

Parameter Type Description In Required
tag string

The tag to be deleted.

query optional
entitySelector string

Specifies the entities where you want to delete tags.

You can set one or several of the following criteria:

  • Entity type (required): type("value").
  • Tag: tag("value"). Tags in [context]key:value, key:value, and value formats are detected and parsed automatically. If a value-only tag has a colon (:) in it, you must escape the colon with a backslash(\). Otherwise, the tag will be parsed as a key:value tag. All tag values are case-sensitive.
  • Management zone ID: mzId("ID")
  • Management zone name: mzName("value"). Management zone names are case-sensitive.
  • Health state (HEALTHY,UNHEALTHY): healthState("HEALTHY")
  • Dynatrace entity ID: entityId("id"). You can specify several IDs, separated by a comma (entityId("id-1","id-2")).
  • Dynatrace entity name: entityName("value"). You can specify several entity names, separated by a comma (entityName("name-1","name-2")). Entity names are case-sensitive.

To set several criteria, separate them with a comma (,). For example, type("HOST"),healthState("HEALTHY"). Only results matching all criteria are included in response.

The length of the string is limited to 10,000 characters.

query optional

Response format

The DeletedEntityTags object

Deleted custom tag.

Element Type Description
deletedTag METag
matchedEntitiesCount integer

The number of monitored entities where the tag has been deleted.

The METag object

The tag of a monitored entity.

Element Type Description
stringRepresentation string

The string representation of the tag.

value string

The value of the tag.

Not applicable to custom tags.

key string

The key of the tag.

Custom tags have the tag value here.

context string

The origin of the tag, such as AWS or Cloud Foundry.

Custom tags use the CONTEXTLESS value.

Example

In this example, the request deletes the REST-test custom tag creates in the POST request example. Again the entitySelector query parameter is set to type("HOST"),tag("easyTravel").

The API token is passed in the Authorization header.

Curl

curl -L -X DELETE 'https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22HOST%22),tag(%22easyTravel%22)&tag=REST-test' \
-H 'Authorization: Api-Token abcdefjhij1234567890'

Request URL

https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22HOST%22),tag(%22easyTravel%22)&tag=REST-test

Response body

{
  "deletedTag": {
    "context": "CONTEXTLESS",
    "key": "REST-test",
    "stringRepresentation": "REST-test"
  },
  "matchedEntitiesCount": 3
}

Response code

200