• Home
  • Dynatrace API
  • Configuration
  • Services
  • Detection rules
  • Opaque web request
  • POST a rule

Service detection API - POST an opaque web request rule

Creates a new service detection rule for opaque and external web requests.

The request consumes and produces an application/json payload.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_REQUEST
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_REQUEST
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_REQUEST

Authentication

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

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

Parameters

Refer to JSON models to find all JSON models that depend on the type of the model.

ParameterTypeDescriptionInRequired
positionstring

The position of the new rule:

  • APPEND: at the end of the rule list.
  • PREPEND: on top of the rule list.
The element can hold these values
  • APPEND
  • PREPEND
queryoptional
bodyOpaqueAndExternalWebRequestRule

The JSON body of the request containing parameters of the new service 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 /ruleBasedServiceDetection/OPAQUE_AND_EXTERNAL_WEB_REQUEST/reorder request.

bodyoptional

Request body objects

The OpaqueAndExternalWebRequestRule object

The service detection rule of the OPAQUE_AND_EXTERNAL_WEB_REQUEST type.

ElementTypeDescriptionRequired
typestring

The type of the service detection rule.

required
metadataConfigurationMetadata

Metadata useful for debugging

optional
managementZonesstring[]

The management zone (specified by the ID) of the process group for which this service detection rule should be created.

You can specify only 1 management zone here.

optional
idstring

The ID of the service detection rule.

optional
orderstring

The order of the rule in the rules list.

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

optional
namestring

The name of the rule.

required
descriptionstring

A short description of the rule.

optional
enabledboolean

The rule is enabled(true) or disabled (false).

required
conditionsConditionsOpaqueAndExternalWebRequestAttributeTypeDto[]

A list of conditions of the rule.

If several conditions are specified, the AND logic applies.

optional
applicationIdApplicationId

The contribution to the service ID calculation from the detected application ID.

You have two mutually exclusive options:

  • Override the detected value with a specified static value. Specify the new value in the valueOverride field.
  • Dynamically transform the detected value. Specify the transformation parameters in the transformations field.
optional
contextRootContextRoot

The contribution to the service ID calculation from the detected context root.

The context root is the first segment of the request URL after server name. For example, in the www.dynatrace.com/support/help/dynatrace-api/ URL the context root is support.

You have two options:

  • Keep a part of the detected URL. Specify the number of segments to be kept in the segmentsToCopyFromUrlPath field.
  • Dynamically transform the detected URL. Specify the transformation parameters in the transformations field.

You can use one or both options. If you use both, the transformation applies to the modified URL.

optional
portPort

The contribution to the service ID calculation from the port, where the web request has been detected.

optional
publicDomainNamePublicDomainName

The contribution to the service ID calculation from the domain name where the web request has been detected.

You have two mutually exclusive options:

  • Override the detected value with a specified static value. Specify the new value in the valueOverride field.
  • Dynamically transform the detected value. Specify the transformation parameters in the transformations field.
optional

The ConfigurationMetadata object

Metadata useful for debugging

ElementTypeDescriptionRequired
configurationVersionsinteger[]

A sorted list of the version numbers of the configuration.

optional
currentConfigurationVersionsstring[]

A sorted list of version numbers of the configuration.

optional
clusterVersionstring

Dynatrace version.

optional

The ConditionsOpaqueAndExternalWebRequestAttributeTypeDto object

A condition of the service detection rule.

ElementTypeDescriptionRequired
attributeTypestring

The type of the attribute to be checked.

The element can hold these values
  • IP
  • PG_TAG
  • TOP_LEVEL_DOMAIN
  • URL
  • URL_HOST_NAME
  • URL_PATH
  • URL_PORT
required
compareOperationsCompareOperation[]

A list of conditions for the rule.

If several conditions are specified, the AND logic applies.

optional

The CompareOperation object

The condition of the rule.

The actual set of fields depends on the type of the condition. Find the list of actual objects in the description of the type field or see Service detection API - JSON models.

ElementTypeDescriptionRequired
typestring

Defines the actual set of fields depending on the value. See one of the following objects:

  • EQUALS -> EqualsCompareOperation
  • STRING_CONTAINS -> StringContainsCompareOperation
  • STARTS_WITH -> StartsWithCompareOperation
  • ENDS_WITH -> EndsWithCompareOperation
  • EXISTS -> ExistsCompareOperation
  • IP_IN_RANGE -> IpInRangeCompareOperation
  • LESS_THAN -> LessThanCompareOperation
  • GREATER_THAN -> GreaterThanCompareOperation
  • INT_EQUALS -> IntEqualsCompareOperation
  • STRING_EQUALS -> StringEqualsCompareOperation
  • TAG -> TagCompareOperation
The element can hold these values
  • ENDS_WITH
  • EQUALS
  • EXISTS
  • GREATER_THAN
  • INT_EQUALS
  • IP_IN_RANGE
  • LESS_THAN
  • STARTS_WITH
  • STRING_CONTAINS
  • STRING_EQUALS
  • TAG
required

The ApplicationId object

The contribution to the service ID calculation from the detected application ID.

You have two mutually exclusive options:

  • Override the detected value with a specified static value. Specify the new value in the valueOverride field.
  • Dynamically transform the detected value. Specify the transformation parameters in the transformations field.
ElementTypeDescriptionRequired
transformationsTransformationBase[]

Transformations to be applied to the detected value.

optional
valueOverridestring

The value to be used instead of the detected value.

optional

The TransformationBase object

Configuration of transformation of the detected value.

If several transformations are specified, they are handled sequentially from top to bottom. Each transformation is applied to the result of the preceding transformation. For example, the second transformation is applied to the result of the first transformation.

The actual set of fields depends on the type of the transformation. Find the list of actual objects in the description of the type field or see Service detection API - JSON models.

ElementTypeDescriptionRequired
typestring

Defines the actual set of fields depending on the value. See one of the following objects:

  • BEFORE -> BeforeTransformation
  • AFTER -> AfterTransformation
  • BETWEEN -> BetweenTransformation
  • REPLACE_BETWEEN -> ReplaceBetweenTransformation
  • REMOVE_NUMBERS -> RemoveNumbersTransformation
  • REMOVE_CREDIT_CARDS -> RemoveCreditCardNumbersTransformation
  • REMOVE_IBANS -> RemoveIBANsTransformation
  • REMOVE_IPS -> RemoveIPsTransformation
  • SPLIT_SELECT -> SplitSelectTransformation
  • TAKE_SEGMENTS -> TakeSegmentsTransformation
The element can hold these values
  • AFTER
  • BEFORE
  • BETWEEN
  • REMOVE_CREDIT_CARDS
  • REMOVE_IBANS
  • REMOVE_IPS
  • REMOVE_NUMBERS
  • REPLACE_BETWEEN
  • SPLIT_SELECT
  • TAKE_SEGMENTS
required

The ContextRoot object

The contribution to the service ID calculation from the detected context root.

The context root is the first segment of the request URL after server name. For example, in the www.dynatrace.com/support/help/dynatrace-api/ URL the context root is support.

You have two options:

  • Keep a part of the detected URL. Specify the number of segments to be kept in the segmentsToCopyFromUrlPath field.
  • Dynamically transform the detected URL. Specify the transformation parameters in the transformations field.

You can use one or both options. If you use both, the transformation applies to the modified URL.

ElementTypeDescriptionRequired
transformationsContextRootTransformation[]

Transformations to be applied to the detected value.

optional
segmentsToCopyFromUrlPathinteger

The number of segments of the URL to be kept.

The URL is divided by slashes (/), the indexing starts with 1 at context root.

For example, if you specify 2 for the www.dynatrace.com/support/help/dynatrace-api/ URL, the value of support/help is used.

optional

The ContextRootTransformation object

Configuration of transformation of the detected value.

If several transformations are specified, they are handled sequentially from top to bottom. Each transformation is applied to the result of the preceding transformation. For example, the second transformation is applied to the result of the first transformation.

The actual set of fields depends on the type of the transformation.

ElementTypeDescriptionRequired
typestring

Defines the actual set of fields depending on the value. See one of the following objects:

  • BEFORE -> BeforeTransformation
  • REPLACE_BETWEEN -> ReplaceBetweenTransformation
  • REMOVE_NUMBERS -> RemoveNumbersTransformation
  • REMOVE_CREDIT_CARDS -> RemoveCreditCardNumbersTransformation
  • REMOVE_IBANS -> RemoveIBANsTransformation
  • REMOVE_IPS -> RemoveIPsTransformation
The element can hold these values
  • BEFORE
  • REMOVE_CREDIT_CARDS
  • REMOVE_IBANS
  • REMOVE_IPS
  • REMOVE_NUMBERS
  • REPLACE_BETWEEN
required

The Port object

The contribution to the service ID calculation from the port, where the web request has been detected.

ElementTypeDescriptionRequired
doNotUseForServiceIdboolean

The port is used (false) or isn't used (true) in the service ID calculation.

optional

The PublicDomainName object

The contribution to the service ID calculation from the domain name where the web request has been detected.

You have two mutually exclusive options:

  • Override the detected value with a specified static value. Specify the new value in the valueOverride field.
  • Dynamically transform the detected value. Specify the transformation parameters in the transformations field.
ElementTypeDescriptionRequired
transformationsTransformationBase[]

Transformations to be applied to the detected value.

optional
valueOverridestring

The value to be used instead of the detected value.

optional
copyFromHostNameboolean

Use (true) or don't use (false) the detected host name as base for transformation.

Not applicable if the override is specified.

optional

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
{ "type": "OPAQUE_AND_EXTERNAL_WEB_REQUEST", "name": "My sample rule", "description": "REST API example", "enabled": true, "managementZones": [ "zone1" ], "conditions": [ { "attributeType": "URL_HOST_NAME", "compareOperations": [ { "type": "STRING_CONTAINS", "ignoreCase": "false", "values": [ "value1", "value2" ] } ] } ], "applicationId": { "valueOverride": "abc" }, "contextRoot": { "segmentsToCopyFromUrlPath": 2, "transformations": [ { "type": "BEFORE", "delimiter": "/" } ] }, "port": { "doNotUseForServiceId": "true" }, "publicDomainName": { "copyFromHostName": "true", "transformations": [ { "type": "BEFORE", "delimiter": "/" } ] } }

Response

Response codes

CodeTypeDescription
201EntityShortRepresentation

Success. The new service detection rule has been created. The response contains short representation of the rule, including the ID.

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.

descriptionstring

A short description of the Dynatrace entity.

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.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_REQUEST/validator
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_REQUEST/validator
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_REQUEST/validator

Authentication

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

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

Response

Response codes

CodeTypeDescription
204

Validated. The service detection rule is valid. Response doesn't have a body.

400ErrorEnvelope

Failed. The input is invalid.

Related topics
  • Service detection and naming

    Find out what Dynatrace looks for when detecting and naming different types of services.

  • Opaque services

    Understand what opaque services are.

  • Monitor third-party services

    Configure how Dynatrace should monitor third-party services.