• Home
  • Dynatrace API
  • Configuration
  • Calculated metrics
  • Web applications
  • POST a metric

Web application metrics API - POST a metric

Creates a new calculated web application metric.

The request consumes and produces an application/json payload.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/rum
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/rum
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/rum

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
bodyWebApplicationMetric

The JSON body of the request. Contains the descriptor of the new calculated web application metric.

bodyrequired

Request body objects

The WebApplicationMetric object

Descriptor of the calculated web application metric.

ElementTypeDescriptionRequired
applicationIdentifierstring

The Dynatrace entity ID of the application to which the metric belongs.

required
namestring

The displayed name of the metric.

required
metricKeystring

The unique key of the metric.

The key must have the calc:apps prefix.

required
enabledboolean

The metric is enabled (true) or disabled (false).

required
metricDefinitionWebApplicationMetricDefinition

Definition of the web application metric.

required
dimensionsWebApplicationDimensionDefinition[]

A list of metric dimensions.

optional
userActionFilterUserActionFilter

User actions filter of the calculated web application metric.

Only user actions matching the provided criteria are used for metric calculation.

A user action must match all the criteria.

optional

The WebApplicationMetricDefinition object

Definition of the web application metric.

ElementTypeDescriptionRequired
metricstring

The type of the web application metric.

The element can hold these values
  • Apdex
  • ApplicationCache
  • Callback
  • CumulativeLayoutShift
  • DNSLookup
  • DOMComplete
  • DOMContentLoaded
  • DOMInteractive
  • DoubleProperty
  • ErrorCount
  • FirstContentfulPaint
  • FirstInputDelay
  • FirstInputStart
  • FirstPaint
  • HTMLDownloaded
  • LargestContentfulPaint
  • LoadEventEnd
  • LoadEventStart
  • LongProperty
  • LongTasksTime
  • NavigationStart
  • OnDOMContentLoaded
  • OnLoad
  • Processing
  • RedirectTime
  • Request
  • RequestStart
  • Response
  • SecureConnect
  • SpeedIndex
  • TCPConnect
  • TimeToFirstByte
  • UserActionDuration
  • VisuallyComplete
required
propertyKeystring

The key of the user action property.

Only applicable for DoubleProperty and LongProperty metrics.

optional

The WebApplicationDimensionDefinition object

Dimension of the calculated web application metrics.

ElementTypeDescriptionRequired
topXinteger

The number of top values to be calculated.

required
dimensionstring

The dimension of the metric.

The element can hold these values
  • ApdexType
  • Browser
  • ErrorContext
  • ErrorOrigin
  • ErrorType
  • GeoLocation
  • StringProperty
  • UserActionType
required
propertyKeystring

The key of the user action property.

Only applicable for the StringProperty dimension.

optional

The UserActionFilter object

User actions filter of the calculated web application metric.

Only user actions matching the provided criteria are used for metric calculation.

A user action must match all the criteria.

ElementTypeDescriptionRequired
actionDurationFromMillisecondsinteger

Only actions with a duration more than or equal to this value (in milliseconds) are included in the metric calculation.

optional
actionDurationToMillisecondsinteger

Only actions with a duration less than or equal to this value (in milliseconds) are included in the metric calculation.

optional
loadActionboolean

The status of load actions in the metric calculation:

  • true: Load actions are included.
  • false: All actions are included.
optional
xhrActionboolean

The status of XHR actions in the metric calculation:

  • true: XHR actions are included.
  • false: All actions are included.
optional
xhrRouteChangeActionboolean

The status of route change actions in the metric calculation:

  • true: Route change actions are included.
  • false: All actions are included.
optional
customActionboolean

The status of custom actions in the metric calculation:

  • true: Custom actions are included.
  • false: All actions are included.
optional
apdexstring

Only actions with the specified Apdex score are included in the metric calculation.

The element can hold these values
  • Frustrated
  • Satisfied
  • Tolerating
  • Unknown
optional
domainstring

Only user actions coming from the specified domain are included in the metric calculation.

The EQUALS operator applies.

optional
userActionNamestring

Only actions with this name are included in the metric calculation.

The EQUALS operator applies.

optional
realUserboolean

The status of actions coming from real users in the metric calculation:

  • true: Only actions from real users are included.
  • false: All actions are included.
optional
robotboolean

The status of actions coming from robots in the metric calculation:

  • true: Only actions from robots are included.
  • false: All actions are included.
optional
syntheticboolean

The status of actions coming from synthetic monitors in the metric calculation:

  • true: Only actions from synthetic monitors are included.
  • false: All actions are included.
optional
browserFamilystring

Only user actions coming from the specified browser family are included in the metric calculation.

The EQUALS operator applies.

optional
browserTypestring

Only user actions coming from the specified browser type are included in the metric calculation.

The EQUALS operator applies.

optional
browserVersionstring

Only user actions coming from the specified browser version are included in the metric calculation.

The EQUALS operator applies.

optional
hasCustomErrorsboolean

The custom error status of the actions to be included in the metric calculation:

  • true: Only actions with custom errors are included.
  • false: All actions are included.
optional
hasAnyErrorboolean

The error status of the actions to be included in the metric calculation:

  • true: Only actions that have any errors are included.
  • false: All actions are included.
optional
hasHttpErrorsboolean

The request error status of the actions to be included in the metric calculation:

  • true: Only actions with request errors (HTTP errors, failed images, CSP rule violations) are included.
  • false: All actions are included.
optional
hasJavascriptErrorsboolean

The JavaScript error status of the actions to be included in the metric calculation:

  • true: Only actions with JavaScript errors are included.
  • false: All actions are included.
optional
citystring

Only actions of users from this city are included in the metric calculation.

Specify geolocation ID here.

optional
continentstring

Only actions of users from this continent are included in the metric calculation.

Specify geolocation ID here.

optional
countrystring

Only actions of users from this country are included in the metric calculation.

Specify geolocation ID here.

optional
regionstring

Only actions of users from this region are included in the metric calculation.

Specify geolocation ID here.

optional
ipstring

Only actions coming from this IP address are included in the metric calculation.

The EQUALS operator applies.

optional
ipV6Trafficboolean

The IPv6 status of the actions to be included in the metric calculation:

  • true: Only actions coming from IPv6 are included.
  • false: All actions are included.
optional
osFamilystring

Only actions coming from this OS family are included in the metric calculation.

Specify the OS ID here.

optional
osVersionstring

Only actions coming from this OS version are included in the metric calculation.

Specify the OS ID here.

optional
httpErrorCodeinteger

The HTTP error status code of the actions to be included in the metric calculation.

optional
httpErrorCodeTointeger

Can be used in combination with httpErrorCode to define a range of error codes that will be included in the metric calculation.

optional
httpPathstring

The request path that has been determined to be the origin of an HTTP error of the actions to be included in the metric calculation.

optional
customErrorTypestring

The custom error type of the actions to be included in the metric calculation.

optional
customErrorNamestring

The custom error name of the actions to be included in the metric calculation.

optional
userActionPropertiesUserActionPropertyFilter[]

Only actions with the specified properties are included in the metric calculation.

optional
targetViewNamestring

Only actions on the specified view are included in the metric calculation.

optional
targetViewNameMatchTypestring

Specifies the match type of the view name filter, e.g. using Contains or Equals. Defaults to Equals.

The element can hold these values
  • Contains
  • Equals
optional
targetViewGroupstring

Only actions on the specified group of views are included in the metric calculation.

optional
targetViewGroupNameMatchTypestring

Specifies the match type of the view group filter, e.g. using Contains or Equals. Defaults to Equals.

The element can hold these values
  • Contains
  • Equals
optional

The UserActionPropertyFilter object

User action property filter.

ElementTypeDescriptionRequired
keystring

The key of the action property we're checking.

optional
valuestring

Only actions that have this value in the specified property are included in the metric calculation.

Only applicable to string values.

optional
fromnumber

Only actions that have a value greater than or equal to this are included in the metric calculation.

Only applicable to numerical values.

optional
tonumber

Only actions that have a value less than or equal to this are included in the metric calculation.

Only applicable to numerical values.

optional
matchTypestring

Specifies the match type of a string filter, e.g. using Contains or Equals.

Only applicable to string values.

The element can hold these values
  • Contains
  • Equals
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.

json
{ "enabled": true, "name": "MyMetric", "metricKey": "calc:apps.web.mymetric", "metricDefinition": { "metric": "UserActionDuration" }, "applicationIdentifier": "APPLICATION-1234", "userActionFilter": { "loadAction": true, "country": "GEOLOCATION-1234", "browserType": "BROWSER-1234" }, "dimensions": [ { "dimension": "GeoLocation", "topX": 20 } ] }

Response

Response codes

CodeTypeDescription
201EntityShortRepresentation

Success. The metric has been created. Response contains its key and name.

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.

descriptionstring

A short description of the Dynatrace entity.

Response body JSON model

json
{ "id": "6a98d7bc-abb9-44f8-ae6a-73e68e71812a", "name": "Dynatrace entity", "description": "Dynatrace entity for the REST API example" }

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.

POSTManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/rum/validator
SaaShttps://{your-environment-id}.live.dynatrace.com/api/config/v1/calculatedMetrics/rum/validator
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/config/v1/calculatedMetrics/rum/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 metric is valid. The response doesn't have a body.

400ErrorEnvelope

Failed. The input is invalid.

Related topics
  • Create calculated metrics for web applications

    Create calculated metrics as well as custom charts based on calculated metrics for your web applications.