• Home
  • Dynatrace API
  • Configuration
  • RUM
  • Applications detection
  • POST a rule

Applications detection rules API - POST a rule

Creates a new application detection rule and adds it to the end of the rules list. To enforce a particular order, use the PUT reorder rules request.

You can create detection rules only for an existing application. If you need to create a rule for an application that doesn't exist yet, create an application first and then configure detection rules for it.

The request consumes and produces an application/json payload.

POSTManaged https://{your-domain}/e/{your-environment-id}/api/config/v1/applicationDetectionRules
SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/applicationDetectionRules
Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/applicationDetectionRules

Authentication

To execute this request, you need an access token with Write configuration (WriteConfig) scope. To learn how to obtain and use it, see Tokens and authentication.

Parameters

The body must not provide an ID. An ID is assigned automatically by Dynatrace.

ParameterTypeDescriptionInRequired
positionstring

The position of the new rule:

  • APPEND: at the bottom of the rule list.
  • PREPEND: at the top of the rule list.

If not set, the APPEND is used.

The element can hold these values
  • APPEND
  • PREPEND
queryoptional
bodyApplicationDetectionRuleConfig

The JSON body of the request. Contains configuration of the new application detection rule.

You must not specify the ID of the rule.

The order field is ignored in this request. To enforce a particular order use the PUT /applicationDetectionRules/order request.

bodyoptional

Request body objects

The ApplicationDetectionRuleConfig object

Application detection rule.

ElementTypeDescription
metadataConfigurationMetadataDtoImpl

Metadata useful for debugging.

Can be null.

idstring

The ID of the rule.

Can be null.

orderstring

The order of the rule in the rules list.

The rules are evaluated from top to bottom. The first matching rule applies.

Can be null.

applicationIdentifierstring

The Dynatrace entity ID of the application, for example APPLICATION-4A3B43.

You must use an existing ID. If you need to create a rule for an application that doesn't exist yet, create an application first and then configure detection rules for it.

filterConfigApplicationFilter

The condition of an application detection rule.

namestring

The unique name of the Application detection rule.

Can be null.

The ConfigurationMetadataDtoImpl object

Metadata useful for debugging.

ElementTypeDescription
currentConfigurationVersionsstring[]

A sorted list of version numbers of the configuration.

Can be null.

configurationVersionsinteger[]

A sorted list of the version numbers of the configuration.

Can be null.

clusterVersionstring

Dynatrace version.

Can be null.

The ApplicationFilter object

The condition of an application detection rule.

ElementTypeDescription
patternstring

The value to look for.

applicationMatchTypestring

The operator of the matching.

The element can hold these values
  • BEGINS_WITH
  • CONTAINS
  • ENDS_WITH
  • EQUALS
  • MATCHES
applicationMatchTargetstring

Where to look for the the pattern value.

The element can hold these values
  • DOMAIN
  • URL

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
{ "metadata": { "configurationVersions": [ 4, 2 ], "clusterVersion": "Mock version" }, "id": "12345678-abcd-1234-abcd-1234567890ab", "applicationIdentifier": "APPLICATION-123456", "name": "uniqueName", "filterConfig": { "pattern": "myapp.example.com", "applicationMatchType": "EQUALS", "applicationMatchTarget": "DOMAIN" } }

Response

Response codes

CodeTypeDescription
201EntityShortRepresentation

Success. The application detection rule has been created. Response contains the ID of the new rule.

400ErrorEnvelope

Failed. The input is invalid.

Response body objects

The EntityShortRepresentation object

The short representation of a Dynatrace entity.

ElementTypeDescription
idstring

The ID of the Dynatrace entity.

namestring

The name of the Dynatrace entity.

Can be null.

descriptionstring

A short description of the Dynatrace entity.

Can be null.

Response body JSON model

json
{ "id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a", "name": "Dynatrace entity", "description": "Dynatrace entity for the REST API example" }

Validate payload

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.

POSTManaged https://{your-domain}/e/{your-environment-id}/api/config/v1/applicationDetectionRules/validator
SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/applicationDetectionRules/validator
Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/applicationDetectionRules/validator

Authentication

To execute this request, you need an access token with Write configuration (WriteConfig) scope. To learn how to obtain and use it, see Tokens and authentication.

Response

Response codes

CodeTypeDescription
204-

Validated. The submitted configuration is valid. Response doesn't have a body.

400ErrorEnvelope

Failed. The input is invalid.

Example

In this example, the request creates a new application detection rule for the BookingApp application that has the ID of APPLICATION-900C1E36674F607D.

The API token is passed in the Authorization header.

The request body 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. Be sure to use an application ID that is available in your environment.

Curl

shell
curl -X POST \ https://mySampleEnv.live.dynatrace.com/api/config/v1/applicationDetectionRules \ -H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890' \ -H 'Content-Type: application/json' \ -d '{ <truncated - see the Request body section > }'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/config/v1/applicationDetectionRules

Request body

json
{ "applicationIdentifier": "APPLICATION-900C1E36674F607D", "filterConfig": { "pattern": "booking", "applicationMatchType": "CONTAINS", "applicationMatchTarget": "URL" } }

Response body

json
{ "id": "9568a82b-73d8-4b18-be1a-4289433e2619", "name": "BookingApp" }

Response code

201

Result

The new application detection rule looks like this in the UI:

POST example

Related topics
  • Real User Monitoring

    Learn about Real User Monitoring, key performance metrics, mobile app monitoring, and more.

  • Check application detection rules

    Learn how you can easily understand detection rules of your RUM application.

  • Define applications for Real User Monitoring

    Learn how to define your applications following the suggested, manual, application detection rules, or browser extension approach.