Service metrics API - PUT a metric on Grail

  • Latest Dynatrace
  • Reference
  • Published Feb 26, 2025

Enables or disables the specified calculated service metric on Grail.

PUTSaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/service/metricsOnGrail/{metricKey}
Environment ActiveGatehttps://{your-activegate-domain}:9999/e/{your-environment-id}/api/config/v1/calculatedMetrics/service/metricsOnGrail/{metricKey}

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
metricKeystring

The key of the calculated service metric to be enabled/disabled on Grail.

pathRequired
bodyServiceMetricToGrail

The JSON body of the request.

bodyRequired

Request body objects

The ServiceMetricToGrail object

Enable/Disable a calculated service metric on Grail

ElementTypeDescriptionRequired
enabledOnGrailboolean

Is calculated service metric enabled on Grail

Required

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.

{
"enabledOnGrail": true
}

Response

Response codes

CodeTypeDescription
204-

Success. The calculated service metric already was or has been enabled/disabled on Grail. Response doesn't have a body.

400ErrorEnvelope

Failed. The input is invalid

Response body objects

The ErrorEnvelope object

ElementTypeDescription
errorError-

The Error object

ElementTypeDescription
codeinteger

The HTTP status code

constraintViolationsConstraintViolation[]

A list of constraint violations

messagestring

The error message

The ConstraintViolation object

A list of constraint violations

ElementTypeDescription
locationstring-
messagestring-
parameterLocationstring-
The element can hold these values
  • HEADER
  • PATH
  • PAYLOAD_BODY
  • QUERY
pathstring-

Response body JSON models

{
"error": {
"code": 1,
"constraintViolations": [
{
"location": "string",
"message": "string",
"parameterLocation": "HEADER",
"path": "string"
}
],
"message": "string"
}
}

api-path

Example

In this example, the request enables the Top 10 queries calculated service metric, which has the metric key of calc:service.top10queries.

Curl

curl -X 'PUT' \
'https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/service/metricsOnGrail/calc%3Aservice.top10queries' \
-H 'accept: */*' \
-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'

Request URL

https://mySampleEnv.live.dynatrace.com/api/config/v1/calculatedMetrics/service/metricsOnGrail/calc%3Aservice.top10queries

Response code

204