Deletes the specified custom tag from the specified monitored entities.
The request produces an application/json
payload.
DELETE | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/tags |
Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/tags |
To execute this request, you need an access token with entities.write
scope.
To learn how to obtain and use it, see Tokens and authentication.
The key of the tag to be deleted.
If deleteAllWithKey is true
, then all tags with this key are deleted. Otherwise, only tags with exact match of key and value are deleted.
For value-only tags, specify the value here.
The value of the tag to be deleted. The value is ignored if deleteAllWithKey is true
.
For value-only tags, specify the value in the key parameter.
true
, all tags with the specified key are deleted, regardless of the value.false
, only tags with exact match of key and value are deleted.If not set, false
is used.
Specifies the entities where you want to delete tags.
You must set one of these criteria:
type("TYPE")
entityId("id")
. You can specify several IDs, separated by a comma (entityId("id-1","id-2")
). All requested entities must be of the same type.You can add one or more of the following criteria. Values are case-sensitive and the EQUALS
operator is used unless otherwise specified.
tag("value")
. Tags in [context]key:value
, key:value
, and value
formats are detected and parsed automatically. Any colons (:
) that are part of the key or value must be escaped with a backslash(\
). Otherwise, it will be interpreted as the separator between the key and the value. All tag values are case-sensitive.mzId(123)
mzName("value")
entityName.equals
: performs a non-casesensitive EQUALS
query.entityName.startsWith
: changes the operator to BEGINS WITH
.entityName.in
: enables you to provide multiple values. The EQUALS
operator applies.caseSensitive(entityName.equals("value"))
: takes any entity name criterion as an argument and makes the value case-sensitive.healthState("HEALTHY")
firstSeenTms.<operator>(now-3h)
. Use any timestamp format from the from/to parameters.
The following operators are available:
lte
: earlier than or at the specified timelt
: earlier than the specified timegte
: later than or at the specified timegt
: later than the specified time<attribute>("value1","value2")
and <attribute>.exists()
. To fetch the list of available attributes, execute the GET entity type request and check the properties field of the response.fromRelationships.<relationshipName>()
and toRelationships.<relationshipName>()
. This criterion takes an entity selector as an attribute. To fetch the list of available relationships, execute the GET entity type request and check the fromRelationships and toRelationships fields.not(<criterion>)
. Inverts any criterion except for type.For more information, see Entity selector in Dynatrace Documentation.
To set several criteria, separate them with a comma (,
). For example, type("HOST"),healthState("HEALTHY")
. Only results matching all criteria are included in the response.
The maximum string length is 2,000 characters.
The start of the requested timeframe.
You can use one of the following formats:
2021-01-25T05:57:01.123+01:00
. If no time zone is specified, UTC is used. You can use a space character instead of the T
. Seconds and fractions of a second are optional.now-NU/A
, where N
is the amount of time, U
is the unit of time, and A
is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w
is one year back, aligned by a week.
You can also specify relative timeframe without an alignment: now-NU
.
Supported time units for the relative timeframe are:
m
: minutesh
: hoursd
: daysw
: weeksM
: monthsy
: yearsIf not set, the relative timeframe of 24 hours is used (now-24h
).
The end of the requested timeframe.
You can use one of the following formats:
2021-01-25T05:57:01.123+01:00
. If no time zone is specified, UTC is used. You can use a space character instead of the T
. Seconds and fractions of a second are optional.now-NU/A
, where N
is the amount of time, U
is the unit of time, and A
is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w
is one year back, aligned by a week.
You can also specify relative timeframe without an alignment: now-NU
.
Supported time units for the relative timeframe are:
m
: minutesh
: hoursd
: daysw
: weeksM
: monthsy
: yearsIf not set, the current timestamp is used.
DeletedEntityTags
objectDeleted custom tag.
The number of monitored entities where the tag has been deleted.
{"matchedEntitiesCount": 2}
In this example, the request deletes the REST-test custom tag created in the POST request example (key=REST-test
). Again the entitySelector query parameter is set to type("HOST"),tag("easyTravel")
.
The API token is passed in the Authorization header.
curl -L -X DELETE 'https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22HOST%22)%2Ctag(%22easyTrave%22)&key=REST-test' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22HOST%22)%2Ctag(%22easyTrave%22)&key=REST-test
{"matchedEntitiesCount": 3}
200