Services API - POST tags
Assigns custom tags to the specified service. You need to provide only a tag value. The CONTEXTLESS
context will be assigned automatically.
w
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 | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v1/entity/services/{meIdentifier} |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v1/entity/services/{meIdentifier} | |
Environment ActiveGate | https://{your-activegate-domain}/e/{your-environment-id}/api/v1/entity/services/{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
Parameter | Type | Description | In | Required |
---|---|---|---|---|
meIdentifier | string | The Dynatrace entity ID of the service you're inquiring. | path | required |
body | Update | A list of tags to be assigned to a Dynatrace entity. | body | optional |
Request body objects
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 |
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.
{
"tags": [
"office-linz",
"office-klagenfurt"
]
}
Response
Response codes
Code | Type | Description |
---|---|---|
204 | Success. The parameters of the service have been updated. | |
400 | ErrorEnvelope | Failed. The input is invalid. |
Example
In this example, the request assigns the PHP tag to the PHP-FPM via domain socket /run/php7-fpm.sock service, which has the ID of SERVICE-72503CBDD2AEF066.
The API token is passed in the Authorization header.
Curl
curl -X POST \
https://mySampleEnv.live.dynatrace.com/api/v1/entity/services/SERVICE-72503CBDD2AEF066 \
-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \
-H 'Content-Type: application/json' \
-d '{
"tags": [
"PHP"
]
}'
Request URL
https://mySampleEnv.live.dynatrace.com/api/v1/entity/services/SERVICE-72503CBDD2AEF066
Request body
{
"tags": [
"PHP"
]
}
Response code
204