• Home
  • Dynatrace API
  • Environment
  • Topology and Smartscape v1
  • Hosts
  • POST tags

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.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{meIdentifier}
SaaShttps://{your-environment-id}.live.dynatrace.com/api/v1/entity/infrastructure/hosts/{meIdentifier}
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/v1/entity/infrastructure/hosts/{meIdentifier}

Authentication

To execute this request, you need an access token with DataExport scope.

To learn how to obtain and use it, see Tokens and authentication.

Parameters

ParameterTypeDescriptionInRequired
meIdentifierstring

The Dynatrace entity ID of the host to be updated.

pathrequired
bodyUpdateEntity

A list of tags to be assigned to a Dynatrace entity.

bodyoptional

Request body objects

The UpdateEntity object

A list of tags to be assigned to a Dynatrace entity.

ElementTypeDescriptionRequired
tagsstring[]

A list of tags to be assigned to a Dynatrace entity.

required

Request body JSON model

This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.

json
{ "tags": [ "office-linz", "office-klagenfurt" ] }

Response

Response codes

CodeTypeDescription
204

Success. The parameters of the host have been updated.

400ErrorEnvelope

Failed. The input is invalid.

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

bash
curl -X POST \ https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-B7A6F9EE9F366CB5 \ -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ -H 'Content-Type: application/json' \ -d '{ "tags": [ "Linux", "Rack 123" ] }'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v1/entity/infrastructure/hosts/HOST-B7A6F9EE9F366CB5

Request body

json
{ "tags": [ "iOS app", "Adnroid app" ] }

Response code

204

Related topics
  • Hosts

    Learn how to get started with host monitoring, understand which measures contribute to host health, how to set up custom host names, and more.