Custom tags API - DELETE tags
Deletes the specified custom tag from the specified monitored entities.
The request produces an application/json
payload.
DELETE | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v2/tags |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/tags | |
Environment and Cluster ActiveGate (default port 9999) | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/tags |
Authentication
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.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
key | string | The key of the tag to be deleted. If deleteAllWithKey is For value-only tags, specify the value here. | query | required |
value | string | The value of the tag to be deleted. The value is ignored if deleteAllWithKey is For value-only tags, specify the value in the key parameter. | query | optional |
deleteAllWithKey | boolean |
If not set, | query | optional |
entitySelector | string | Specifies the entities where you want to delete tags. You must set one of these criteria:
You can add one or more of the following criteria. Values are case-sensitive and the
For more information, see Entity selector in Dynatrace Documentation. To set several criteria, separate them with a comma ( The maximum string length is 2,000 characters. | query | required |
from | string | The start of the requested timeframe. You can use one of the following formats:
If not set, the relative timeframe of 24 hours is used ( | query | optional |
to | string | The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. | query | optional |
Response
Response codes
Code | Type | Description |
---|---|---|
200 | DeletedEntityTags | Success |
4XX | ErrorEnvelope | Client side error. |
5XX | ErrorEnvelope | Server side error. |
Response body objects
The DeletedEntityTags
object
Deleted custom tag.
Element | Type | Description |
---|---|---|
matchedEntitiesCount | integer | The number of monitored entities where the tag has been deleted. |
Response body JSON model
{"matchedEntitiesCount": 2}
Example
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
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'
Request URL
https://mySampleEnv.live.dynatrace.com/api/v2/tags?entitySelector=type(%22HOST%22)%2Ctag(%22easyTrave%22)&key=REST-test
Response body
{"matchedEntitiesCount": 3}
Response code
200