Synthetic metrics API - POST a metric
Creates a new calculated synthetic metric.
The request consumes and produces an application/json
payload.
POST | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/synthetic |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/synthetic | |
Environment ActiveGate | https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/synthetic |
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
Parameter | Type | Description | In | Required |
---|---|---|---|---|
body | Calculated | The JSON body of the request. Contains definition of the new calculated synthetic metric. | body | optional |
Request body objects
The CalculatedSyntheticMetric
object
Definition of the calculated synthetic metric.
Element | Type | Description | Required |
---|---|---|---|
dimensions | Synthetic | A list of metric dimensions. | optional |
enabled | boolean | The metric is enabled ( | required |
filter | Synthetic | Filter of the calculated synthetic metric. | optional |
metric | string | The type of the synthetic metric. | required |
metricKey | string | The unique key of the metric. The key must have the | required |
monitorIdentifier | string | The Dynatrace entity ID of the synthetic monitor to which the metric belongs. | required |
name | string | The name of the metric, displayed in the UI. | required |
The SyntheticMetricDimension
object
Dimension of the calculated synthetic metric.
Element | Type | Description | Required |
---|---|---|---|
dimension | string | The dimension of the metric. | required |
topX | integer | The number of top values to be calculated. | optional |
The SyntheticMetricFilter
object
Filter of the calculated synthetic metric.
Element | Type | Description | Required |
---|---|---|---|
actionType | string | Only user actions of the specified type are included in the metric calculation. | optional |
errorCode | integer | Only executions finished with the specified error code are included in the metric calculation. | optional |
event | string | Only the specified browser clickpath event is included in the metric calculation. Specify the Dynatrace entity ID of the event here. You can fetch the list of clickpath events of the monitor with the GET a synthetic monitor request from the Environment API | optional |
hasError | boolean | The execution status of the monitors to be included in the metric calculation:
| optional |
location | string | Only executions from the specified location are included in the metric calculation. Specify the Dynatrace entity ID of the location here. You can fetch the list of locations the monitor is running from with the GET a synthetic monitor request from the Environment API. | 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.
{
"dimensions": [
{
"dimension": "Location"
}
],
"enabled": true,
"filter": {
"event": "SYNTHETIC_TEST_STEP-1234",
"hasError": true
},
"metric": "UserActionDuration",
"metricKey": "calc:synthetic.browser.mymetric",
"monitorIdentifier": "SYNTHETIC_TEST-1234",
"name": "MyMetric"
}
Response
Response codes
Code | Type | Description |
---|---|---|
201 | Entity | Success. The calculated synthetic metric has been created. Response contains its key and name. |
400 | ErrorEnvelope | Failed. The input is invalid |
Response body objects
The EntityShortRepresentation
object
The short representation of a Dynatrace entity.
Element | Type | Description |
---|---|---|
description | string | A short description of the Dynatrace entity. |
id | string | The ID of the Dynatrace entity. |
name | string | 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.
POST | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/synthetic/validator |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/synthetic/validator | |
Environment ActiveGate | https://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/synthetic/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
Code | Type | Description |
---|---|---|
204 | Validated. The submitted calculated synthetic metric is valid. The response doesn't have a body. | |
400 | ErrorEnvelope | Failed. The input is invalid. |