• Home
  • Dynatrace API
  • Configuration
  • Services
  • Custom services
  • PUT a rule

Custom services API - PUT a custom service rule

PUT a custom service rule

Updates the specified custom service rule.

The request consumes and produces an application/json payload.

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

ParameterTypeDescriptionInRequired
technologystring

Technology of the custom service to update.

The element can hold these values
  • dotNet
  • go
  • java
  • nodeJS
  • php
pathrequired
idstring

The ID of the custom service to update.

The ID of the custom service in the body of the request must match this ID.

pathrequired
bodyCustomService

JSON body of the request containing updated definition of the custom service. If order is present, it will be used.

bodyoptional

Request body objects

The CustomService object

ElementTypeDescription
metadataConfigurationMetadata

Metadata useful for debugging

Can be null.

idstring

The ID of the custom service.

Can be null.

namestring

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

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.

Can be null.

enabledboolean

Custom service enabled/disabled.

rulesDetectionRule[]

The list of rules defining the custom service.

queueEntryPointboolean

The queue entry point flag.

Set to true for custom messaging services.

queueEntryPointTypestring

The queue entry point type..

The element can hold these values
  • IBM_MQ
  • JMS
  • KAFKA
  • MSMQ
  • RABBIT_MQ

Can be null.

processGroupsstring[]

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

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 DetectionRule object

ElementTypeDescription
idstring

The ID of the detection rule.

Can be null.

enabledboolean

Rule enabled/disabled.

fileNamestring

The PHP file containing the class or methods to instrument.

Required for PHP custom service.

Not applicable to Java and .NET.

Can be null.

fileNameMatcherstring

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

The element can hold these values
  • ENDS_WITH
  • EQUALS
  • STARTS_WITH

Can be null.

classNamestring

The fully qualified class or interface to instrument.

Required for Java and .NET custom services.

Not applicable to PHP.

Can be null.

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.

The element can hold these values
  • ENDS_WITH
  • EQUALS
  • STARTS_WITH

Can be null.

methodRulesMethodRule[]

List of methods to instrument.

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.

Can be null.

The MethodRule object

ElementTypeDescription
idstring

The ID of the method rule.

Can be null.

methodNamestring

The method to instrument.

argumentTypesstring[]

Fully qualified types of argument the method expects.

Can be null.

returnTypestring

Fully qualified type the method returns.

visibilitystring

The visibility of the method rule.

The element can hold these values
  • INTERNAL
  • PACKAGE_PROTECTED
  • PRIVATE
  • PROTECTED
  • PUBLIC

Can be null.

modifiersstring[]

The modifiers of the method rule.

The element can hold these values
  • ABSTRACT
  • EXTERN
  • FINAL
  • NATIVE
  • STATIC

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
{ "name": "CustomService", "enabled": true, "rules": [ { "enabled": true, "className": "com.your.company.ClassName", "methodRules": [ { "methodName": "AMethod", "argumentTypes": [ "java.lang.String" ], "returnType": "void" } ] } ], "queueEntryPoint": false }

Response

Response codes

CodeTypeDescription
201EntityShortRepresentation

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

204-

Success. Custom service 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

{snippet name='dynatrace-api/validate-payload.md'}}

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

400ErrorEnvelope

Failed. The input is invalid

Related topics
  • Define custom services

    Learn how to configure custom services such as Java, .NET, PHP, and more.