• Home
  • Dynatrace API
  • Configuration
  • Services
  • Detection rules
  • Opaque web service
  • PUT a rule

Service detection API - PUT an opaque web service rule

Updates an existing service detection rule for opaque and external web services.

If a rule with the specified ID doesn’t exist, a new rule is created and appended to the end of the rule list.

The request keeps the existing order of rules unless the order parameter is set.

The request consumes and produces an application/json payload.

PUTManaged https://{your-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_SERVICE/{id}
SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_SERVICE/{id}
Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_SERVICE/{id}

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

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

ParameterTypeDescriptionInRequired
idstring

The ID of the rule to be updated.

pathrequired
bodyOpaqueAndExternalWebServiceRule

The JSON body of the request containing updated parameters of the service detection rule.

bodyoptional

Request body objects

The OpaqueAndExternalWebServiceRule object

The service detection rule of the OPAQUE_AND_EXTERNAL_WEB_SERVICE type

ElementTypeDescription
typestring

The type of the service detection rule.

metadataConfigurationMetadata

Metadata useful for debugging

Can be null.

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.

Can be null.

idstring

The ID of the service detection 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.

namestring

The name of the rule.

descriptionstring

A short description of the rule.

Can be null.

enabledboolean

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

conditionsConditionsOpaqueAndExternalWebServiceAttributeTypeDto[]

A list of conditions of the rule.

If several conditions are specified, the AND logic applies.

Can be null.

detectAsWebRequestServiceboolean

Detect the matching requests as web services (false) or web request services (true).

Setting this field to true prevents detecting of matching requests as opaque web services. An opaque web request service is created instead. If you need to further modify the resulting web request service, you need to create a separate rule of the OPAQUE_AND_EXTERNAL_WEB_REQUEST type.

Default is false, detecting matching requests as opaque web services.

Can be null.

urlPathUrlPath

The contribution from the URL, where the web request has been detected, into service ID calculation.

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.

Can be null.

portPort

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

Can be null.

The ConfigurationMetadata object

Metadata useful for debugging

ElementTypeDescription
configurationVersionsinteger[]

A sorted list of the version numbers of the configuration.

Can be null.

currentConfigurationVersionsstring[]

A sorted list of version numbers of the configuration.

Can be null.

clusterVersionstring

Dynatrace version.

Can be null.

The ConditionsOpaqueAndExternalWebServiceAttributeTypeDto object

A condition of the service detection rule.

ElementTypeDescription
attributeTypestring

The type of the attribute to be checked.

The element can hold these values
  • ENDPOINT
  • IP
  • OPERATION_NAME
  • PG_TAG
  • URL_PATH
  • URL_PORT
compareOperationsCompareOperation[]

A list of conditions for the rule.

If several conditions are specified, the AND logic applies.

Can be null.

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.

ElementTypeDescription
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

The UrlPath object

The contribution from the URL, where the web request has been detected, into service ID calculation.

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.
ElementTypeDescription
transformationsTransformationBase[]

Transformations to be applied to the detected value.

Can be null.

valueOverridestring

The value to be used instead of the detected value.

Can be null.

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.

ElementTypeDescription
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

The Port object

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

ElementTypeDescription
doNotUseForServiceIdboolean

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

Can be null.

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_SERVICE", "name": "My sample rule", "description": "REST API example", "enabled": true, "detectAsWebRequestService": false, "managementZones": [ "zone 1" ], "conditions": [ { "attributeType": "URL_PATH", "compareOperations": [ { "type": "STRING_CONTAINS", "invert": "false", "ignoreCase": "false", "values": [ "value1", "value2" ] } ] } ], "urlPath": { "valueOverride": "abc" }, "port": { "doNotUseForServiceId": "true" } }

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.

204-

Success. The service detection rule has been updated. Response doesn't have a body.

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/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_SERVICE/{id}/validator
SaaS https://{your-environment-id}.live.dynatrace.com/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_SERVICE/{id}/validator
Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/service/detectionRules/OPAQUE_AND_EXTERNAL_WEB_SERVICE/{id}/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 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.