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.

POST
  • Managed https://{your-domain}/e/{your-environment-id}/api/config/v1/applicationDetectionRules
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/applicationDetectionRules

Authentication

To execute this request, you need the Write configuration (WriteConfig) permission assigned to your API token. To learn how to obtain and use it, see Authentication.

Parameters

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

Parameter Type Description In Required
position string

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 position element can hold these values.
query optional
body ApplicationDetectionRuleConfig

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.

body optional

The ApplicationDetectionRuleConfig object

Application detection rule.

Element Type Description Required
metadata ConfigurationMetadataDtoImpl optional
id string

The ID of the rule.

optional
order string

The order of the rule in the rules list.

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

optional
applicationIdentifier string

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.

required
filterConfig ApplicationFilter required

The ApplicationFilter object

The condition of an application detection rule.

Element Type Description Required
pattern string

The value to look for.

required
applicationMatchType string

The operator of the matching.

The applicationMatchType element can hold these values.
required
applicationMatchTarget string

Where to look for the the pattern value.

The applicationMatchTarget element can hold these values.
required

The ConfigurationMetadataDtoImpl object

Metadata useful for debugging.

Element Type Description Required
configurationVersions integer[]

A Sorted list of the version numbers of the configuration.

optional
clusterVersion string

Dynatrace server version.

optional

Possible values

Possible values for the position element:

  • APPEND
  • PREPEND

Possible values for the applicationMatchTarget element in the ApplicationFilter object:

  • DOMAIN
  • URL

Possible values for the applicationMatchType element in the ApplicationFilter object:

  • BEGINS_WITH
  • CONTAINS
  • ENDS_WITH
  • EQUALS
  • MATCHES

Response format

The EntityShortRepresentation object

The short representation of a Dynatrace entity.

Element Type Description
id string

The ID of the Dynatrace entity.

name string

The name of the Dynatrace entity.

description string

A short description of the Dynatrace entity.

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.

The request consumes an application/json payload.

POST
  • Managed 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

Authentication

To execute this request, you need the Write configuration (WriteConfig) permission assigned to your API token. To learn how to obtain and use it, see Authentication.

Response codes

Code Description
204 Validated. The submitted configuration is valid. Response doesn't have a body.
400 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

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

Request URL

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

Request body

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

Response body

{
  "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