Custom services API - POST a custom service rule

Creates a new custom service rule.

The request consumes and produces an application/json payload.

POSTSaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/service/customServices/{technology}
Environment ActiveGatehttps://{your-activegate-domain}:9999/e/{your-environment-id}/api/config/v1/service/customServices/{technology}

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

ParameterTypeDescriptionInRequired
technologystring

Technology of the new custom service.

  • dotNet
  • go
  • java
  • nodeJS
  • php
pathrequired
positionstring

Order of the new custom service. Set to PREPEND to prepend it to the list, APPEND to append it. Defaults to APPEND.

  • APPEND
  • PREPEND
queryoptional
bodyCustomService

JSON body of the request containing definition of the new custom service.

You must not specify the IDs for the custom service or any of its rules. The order field is not allowed either.

bodyoptional

Request body objects

The CustomService object

ElementTypeDescriptionRequired
enabledboolean

Custom service enabled/disabled.

required
idstring

The ID of the custom service.

optional
metadataConfigurationMetadata

Metadata useful for debugging

optional
namestring

The name of the custom service, displayed in the UI.

required
orderstring

The order string. Sorting custom services alphabetically by their order string determines their relative ordering.

Typically this is managed by Dynatrace internally and will not be present in GET responses.

optional
processGroupsstring[]

The list of process groups the custom service should belong to.

optional
queueEntryPointboolean

The queue entry point flag.

Set to true for custom messaging services.

required
queueEntryPointTypestring

The queue entry point type..

  • AWS_SQS
  • AZURE_SERVICE_BUS
  • IBM_MQ
  • JMS
  • KAFKA
  • MSMQ
  • RABBIT_MQ
optional
rulesDetectionRule[]

The list of rules defining the custom service.

required

The ConfigurationMetadata object

Metadata useful for debugging

ElementTypeDescriptionRequired
clusterVersionstring

Dynatrace version.

optional
configurationVersionsinteger[]

A sorted list of the version numbers of the configuration.

optional
currentConfigurationVersionsstring[]

A sorted list of version numbers of the configuration.

optional

The DetectionRule object

ElementTypeDescriptionRequired
annotationsstring[]

Additional annotations filter of the rule.

Only classes where all listed annotations are available in the class itself or any of its superclasses are instrumented.

Not applicable to PHP.

optional
classNamestring

The fully qualified class or interface to instrument.

Required for Java and .NET custom services.

Not applicable to PHP.

optional
enabledboolean

Rule enabled/disabled.

required
fileNamestring

The PHP file containing the class or methods to instrument.

Required for PHP custom service.

Not applicable to Java and .NET.

optional
fileNameMatcherstring

Matcher applying to the file name. Default value is ENDS_WITH (if applicable).

  • ENDS_WITH
  • EQUALS
  • STARTS_WITH
optional
idstring

The ID of the detection rule.

optional
matcherstring

Matcher applying to the class name. STARTS_WITH can only be used if there is at least one annotation defined. Default value is EQUALS.

  • ENDS_WITH
  • EQUALS
  • STARTS_WITH
optional
methodRulesMethodRule[]

List of methods to instrument.

required

The MethodRule object

ElementTypeDescriptionRequired
argumentTypesstring[]

Fully qualified types of argument the method expects.

optional
idstring

The ID of the method rule.

optional
methodNamestring

The method to instrument.

required
modifiersstring[]

The modifiers of the method rule.

  • ABSTRACT
  • EXTERN
  • FINAL
  • NATIVE
  • STATIC
optional
returnTypestring

Fully qualified type the method returns.

required
visibilitystring

The visibility of the method rule.

  • INTERNAL
  • PACKAGE_PROTECTED
  • PRIVATE
  • PROTECTED
  • PUBLIC
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.

{
"enabled": true,
"name": "CustomService",
"queueEntryPoint": false,
"rules": [
{
"className": "com.your.company.ClassName",
"enabled": true,
"methodRules": [
{
"argumentTypes": [
"java.lang.String"
],
"methodName": "AMethod",
"returnType": "void"
}
]
}
]
}

Response

Response codes

CodeTypeDescription
201EntityShortRepresentation

Success. The custom service has been created. Response contains the new service's ID and name.

400ErrorEnvelope

Failed. The input is invalid

Response body objects

The EntityShortRepresentation object

The short representation of a Dynatrace entity.

ElementTypeDescription
descriptionstring

A short description of the Dynatrace entity.

idstring

The ID of the Dynatrace entity.

namestring

The name of the Dynatrace entity.

Response body JSON model

{
"description": "Dynatrace entity for the REST API example",
"id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a",
"name": "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.

POSTSaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/service/customServices/{technology}/validator
Environment ActiveGatehttps://{your-activegate-domain}:9999/e/{your-environment-id}/api/config/v1/service/customServices/{technology}/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 submitted configuration is valid. Response does not have a body.

400ErrorEnvelope

Failed. The input is invalid