Hosts API - POST tags
Assigns custom tags to the specified host. You only need to provide a tag value. The CONTEXTLESS
context will be assigned automatically.
The usage of this API is limited to value-only tags. To assign key:value tags, use the Custom tags API.
The request consumes an application/json
payload.
POST |
|
Authentication
To execute this request, you need the Access problem and event feed, metrics, and topology (DataExport
) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
meIdentifier | string |
The Dynatrace entity ID of the host to be updated. |
path | required |
body | UpdateEntity | body | optional |
Body format
The UpdateEntity object
A list of tags to be assigned to a Dynatrace entity.
Element | Type | Description | Required |
---|---|---|---|
tags | string[] |
A list of tags to be assigned to a Dynatrace entity. |
required |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request. See the Example expandable section for working sample request.
{
"tags": [
"office-linz",
"office-klagenfurt"
]
}
Response
Response codes
Code | Description |
---|---|
204 | Success. The parameters of the host have been updated. |
400 | Failed. The input is invalid. |
Response body
A successful request doesn't return any content.
Example
In this example, the request assigns the Linux and Rack 123 tags to the tag009 host, which has the ID of HOST-B7A6F9EE9F366CB5.
The API token is passed in the Authorization header.
Curl
curl -X POST \
https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-B7A6F9EE9F366CB5 \
-H 'Authorization: Api-Token abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
-d '{
"tags": [
"Linux",
"Rack 123"
]
}'
Request URL
https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-B7A6F9EE9F366CB5
Request body
{
"tags": [
"iOS app",
"Adnroid app"
]
}
Response code
204