deprecated
This API is deprecated. Use the Settings API with the Automatically applied tags (builtin:tags.auto-tagging
) schema instead.
Creates a new automatically applied tag.
The request consumes and produces an application/json
payload.
POST | SaaS | https://{your-environment-id}.live.dynatrace.com/api/config/v1/autoTags |
Environment ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/config/v1/autoTags |
To execute this request, you need an access token with WriteConfig
scope.
To learn how to obtain and use it, see Tokens and authentication.
Refer to JSON models to find all JSON models that depend on the type of the model.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | Auto | The JSON body of the request. Contains parameters of the new auto-tag. | body | optional |
AutoTag
objectConfiguration of an auto-tag. It defines the conditions of tag usage and the tag value.
Element | Type | Description | Required |
---|---|---|---|
description | string | The description of the auto-tag. | optional |
entitySelectorBasedRules | Entity | A list of entity-selector based rules for auto tagging usage. If several rules are specified, the OR logic applies. | optional |
id | string | The ID of the auto-tag. | optional |
metadata | Configuration | Metadata useful for debugging | optional |
name | string | The name of the auto-tag, which is applied to entities. Additionally you can specify a valueFormat in the tag rule. In that case the tag is used in the For example you can extend the | required |
rules | Auto | The list of rules for tag usage. When there are multiple rules, the OR logic applies. | optional |
EntitySelectorBasedAutoTagRule
objectThe entity-selector-based rule for auto tag usage. It allows tagging entities via an entity selector.
Element | Type | Description | Required |
---|---|---|---|
enabled | boolean | The rule is enabled ( | optional |
entitySelector | string | The entity selector string, by which the entities are selected. | required |
normalization | string | Changes applied to the value after applying the value format. Default is LEAVE_TEXT_AS_IS.
| optional |
valueFormat | string | The value of the entity-selector-based auto-tag. If specified, the tag is used in the For example, you can extend the | optional |
ConfigurationMetadata
objectMetadata useful for debugging
Element | Type | Description | Required |
---|---|---|---|
clusterVersion | string | Dynatrace version. | optional |
configurationVersions | integer[] | A sorted list of the version numbers of the configuration. | optional |
currentConfigurationVersions | string[] | A sorted list of version numbers of the configuration. | optional |
AutoTagRule
objectA rule for the auto-tag.
Defines the conditions of tag usage.
Element | Type | Description | Required |
---|---|---|---|
conditions | Entity | A list of matching rules for the auto-tag. The tag applies only when all conditions are fulfilled. | required |
enabled | boolean | Tag rule is enabled ( | required |
normalization | string | Changes applied to the value after applying the value format. Default is LEAVE_TEXT_AS_IS.
| optional |
propagationTypes | string[] | How to apply the tag to underlying entities:
| optional |
type | string | Type of entities to which the rule applies.
| required |
valueFormat | string | The value of the auto-tag. If specified, the tag is used in the For example, you can extend the You can use the following placeholders here:
| optional |
EntityRuleEngineCondition
objectA condition defines how to execute matching logic for an entity.
Element | Type | Description | Required |
---|---|---|---|
comparisonInfo | Comparison | Defines how the matching is actually performed: what and how are we comparing. The actual set of fields and possible values of the operator field depend on the type of the comparison. Find the list of actual objects in the description of the type field or see JSON models. | required |
key | Condition | The key to identify the data we're matching. The actual set of fields and possible values depend on the type of the key. Find the list of actual objects in the description of the type field or see JSON models. | required |
ComparisonBasic
objectDefines how the matching is actually performed: what and how are we comparing.
The actual set of fields and possible values of the operator field depend on the type of the comparison. Find the list of actual objects in the description of the type field or see JSON models.
Element | Type | Description | Required |
---|---|---|---|
negate | boolean | Reverses the comparison operator. For example it turns the begins with into does not begin with. | required |
operator | string | Operator of the comparison. You can reverse it by setting negate to Possible values depend on the type of the comparison. Find the list of actual models in the description of the type field and check the description of the model you need. | required |
type | string | Defines the actual set of fields depending on the value. See one of the following objects:
| required |
value | string | The value to compare to. | optional |
AnyValue
objectA schema representing an arbitrary value type.
ConditionKey
objectThe key to identify the data we're matching.
The actual set of fields and possible values depend on the type of the key. Find the list of actual objects in the description of the type field or see JSON models.
Element | Type | Description | Required |
---|---|---|---|
attribute | string | The attribute to be used for comparison.
| required |
type | string | Defines the actual set of fields depending on the value. See one of the following objects:
| optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"description": "sampleDescription","entitySelectorBasedRules": [{"enabled": true,"entitySelector": "type(HOST) AND cpuCores(4)"}],"name": "sampleAutoTag","rules": [{"conditions": [{"comparisonInfo": {"caseSensitive": false,"negate": false,"operator": "BEGINS_WITH","type": "STRING","value": "sample"},"key": {"attribute": "SERVICE_DATABASE_NAME"}},{"comparisonInfo": {"negate": false,"operator": "EXISTS","type": "STRING"},"key": {"attribute": "SERVICE_WEB_SERVER_NAME"}},{"comparisonInfo": {"caseSensitive": false,"negate": false,"operator": "BEGINS_WITH","type": "STRING","value": "sample"},"key": {"attribute": "PROCESS_GROUP_CUSTOM_METADATA","dynamicKey": {"key": "kubernetes.io/limit-ranger","source": "KUBERNETES"},"type": "PROCESS_CUSTOM_METADATA_KEY"}}],"enabled": true,"propagationTypes": ["SERVICE_TO_HOST_LIKE"],"type": "SERVICE","valueFormat": "myTagValue {Service:DetectedName}"}]}
Code | Type | Description |
---|---|---|
201 | Entity | Success. The auto-tag has been created. The response body contains the ID of the new auto-tag. |
400 | Error | Failed. The input is invalid. |
EntityShortRepresentation
objectThe short representation of a Dynatrace entity.
Element | Type | Description |
---|---|---|
description | string | A short description of the Dynatrace entity. |
id | string | The ID of the Dynatrace entity. |
name | string | The name of the Dynatrace entity. |
{"description": "Dynatrace entity for the REST API example","id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a","name": "Dynatrace entity"}
We recommend that you validate the payload before submitting it with an actual request. A response code of 204 indicates a valid payload.
The request consumes an application/json
payload.
POST | SaaS | https://{your-environment-id}.live.dynatrace.com/api/config/v1/autoTags/validator |
Environment ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/config/v1/autoTags/validator |
To execute this request, you need an access token with WriteConfig
scope.
To learn how to obtain and use it, see Tokens and authentication.
Code | Type | Description |
---|---|---|
204 | - | Validated. The submitted configuration is valid. Response doesn't have a body. |
400 | Error | Failed. The input is invalid. |
In this example, the request creates a new auto-tag for Services where the service name contains main
. The services and hosts they're running on were assigned the MainApp tag.
The API token is passed in the Authorization header.
The request body is lengthy, so it is truncated in the Curl section. See the Request body section for the full body. You can download or copy the example request body to try it out on your own.
curl -X POST \https://mySampleEnv.live.dynatrace.com/api/config/v1/autoTags \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \-H 'Content-Type: application/json' \-d '{ <truncated - see the Request body section > }'
https://mySampleEnv.live.dynatrace.com/api/config/v1/autoTags
{"name": "MainApp","rules": [{"type": "SERVICE","enabled": true,"valueFormat": null,"propagationTypes": ["SERVICE_TO_HOST_LIKE"],"conditions": [{"key": {"attribute": "SERVICE_NAME"},"comparisonInfo": {"type": "STRING","operator": "CONTAINS","value": "main","negate": false,"caseSensitive": false}}]}]}
{"id": "e3f5bfc1-ead4-4af8-9372-48beb05e03f9","name": "MainApp"}
201
The new auto-tag looks like this in the UI: