Service detection rules API - PUT a rule
Updates an existing service detection rule for opaque and external web requests.
If the rule with the specified ID doesn’t exist, a new rule will be created and appended to the end of the rule list.
The request keeps the existing order of rules unless the order parameter is set.
This request is an Early Adopter release and may be changed in non-compatible way.
PUT |
|
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 Tokens and authentication.
Parameters
Refer to JSON models to find all JSON models that depend on the type of the model.
Parameter | Type | Description | In | Required |
---|---|---|---|---|
id | string |
The ID of the rule to be updated. |
path | required |
body | OpaqueAndExternalWebRequestRule |
The JSON body of the request containing updated parameters of the service detection rule. |
body | optional |
Body format
The OpaqueAndExternalWebRequestRule object
The service detection rule of the OPAQUE_AND_EXTERNAL_WEB_REQUEST
type.
Element | Type | Description | Required |
---|---|---|---|
type | string |
The type of the service detection rule. |
required |
metadata | ConfigurationMetadata | optional | |
managementZones | string[] |
Specifies the management zones of the process group for which this service detection rule should be created. |
optional |
id | string |
The ID of the service detection 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 |
name | string |
The name of the rule. |
required |
description | string |
A short description of the rule. |
optional |
enabled | boolean |
The rule is enabled( |
required |
conditions | ConditionsOpaqueAndExternalWebRequestAttributeTypeDto[] |
A list of conditions of the rule. If several conditions are specified, the AND logic applies. |
optional |
applicationId | ApplicationId | optional | |
contextRoot | ContextRoot | optional | |
port | Port | optional | |
publicDomainName | PublicDomainName | 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.
Element | Type | Description | Required |
---|---|---|---|
transformations | TransformationBase[] |
Transformations to be applied to the detected value. |
optional |
valueOverride | string |
The value to be used instead of the detected value. |
optional |
copyFromHostName | boolean |
Use ( Not applicable if the override is specified. |
optional |
The Port object
The contribution to the service ID calculation from the port, where the web request has been detected.
Element | Type | Description | Required |
---|---|---|---|
doNotUseForServiceId | boolean |
The port is used ( |
optional |
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/extend-dynatrace/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.
Element | Type | Description | Required |
---|---|---|---|
transformations | ContextRootTransformation[] |
Transformations to be applied to the detected value. |
optional |
segmentsToCopyFromUrlPath | integer |
The number of segments of the URL to be kept. The URL is divided by slashes ( For example, if you specify |
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.
Element | Type | Description | Required |
---|---|---|---|
type | string |
Defines the actual set of fields depending on the value. See one of the following objects:
|
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.
Element | Type | Description | Required |
---|---|---|---|
transformations | TransformationBase[] |
Transformations to be applied to the detected value. |
optional |
valueOverride | string |
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.
Element | Type | Description | Required |
---|---|---|---|
type | string |
Defines the actual set of fields depending on the value. See one of the following objects:
|
required |
The ConditionsOpaqueAndExternalWebRequestAttributeTypeDto object
A condition of the service detection rule.
Element | Type | Description | Required |
---|---|---|---|
attributeType | string |
The type of the attribute to be checked. |
required |
compareOperations | CompareOperation[] |
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.
Element | Type | Description | Required |
---|---|---|---|
type | string |
Defines the actual set of fields depending on the value. See one of the following objects:
|
required |
The ConfigurationMetadata object
Metadata useful for debugging
Element | Type | Description | Required |
---|---|---|---|
configurationVersions | integer[] |
A Sorted list of the version numbers of the configuration. |
optional |
currentConfigurationVersions | string[] |
A Sorted list of string version numbers of the configuration. |
optional |
clusterVersion | string |
Dynatrace server version. |
optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request. See the Example expandable section for working sample request.
{
"type": "OPAQUE_AND_EXTERNAL_WEB_REQUEST",
"name": "My sample rule",
"description": "REST API example\n",
"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
Code | Description |
---|---|
201 | 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. |
400 | Failed. The input is invalid. |
Response body
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. |
{
"id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a",
"name": "Dynatrace entity",
"description": "Dynatrace entity for the REST API example\n"
}
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.
This request is an Early Adopter release and may be changed in non-compatible way.
POST |
|
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 Tokens and authentication.
Response
Response codes
Code | Description |
---|---|
204 | Validated. The service detection rule is valid. Response doesn't have a body. |
400 | Failed. The input is invalid. |
Response body
A successful request doesn't return any content.