Metric units API - GET all units
Lists all available metric units of your environment.
The request produces an application/json
payload.
GET | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v2/units |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/units | |
Environment ActiveGate | https://{your-activegate-domain}/e/{your-environment-id}/api/v2/units |
Authentication
To execute this request, you need an access token with metrics.read
scope.
To learn how to obtain and use it, see Tokens and authentication.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
unitSelector | string | Selects units to be included to the response. Available criteria:
| query | optional |
fields | string | Defines the list of properties to be included in the response. The ID of the unit is always included. The following additional properties are available:
By default, the ID, the display name, and the symbol are included. To add properties, list them with leading plus To specify several properties, join them with a comma (for example If you specify just one property, the response contains the unitId and the specified property. To return unit IDs only, specify | query | optional |
Response
Response codes
Code | Type | Description |
---|---|---|
200 | Unit | Success |
Response body objects
The UnitList
object
A list of units along with their properties.
Element | Type | Description |
---|---|---|
units | Unit[] | A list of units. |
totalCount | integer | The total number of units in the result. |
The Unit
object
The metadata of a unit.
Element | Type | Description |
---|---|---|
unitId | string | The ID of the unit. |
displayName | string | The display name of the unit. |
symbol | string | The symbol of the unit. |
description | string | A short description of the unit. |
displayNamePlural | string | The plural display name of the unit. |
Response body JSON model
{
"totalCount": 2,
"units": [
{
"unitId": "BytePerSecond",
"displayName": "byte per second",
"displayNamePlural": "bytes per second",
"symbol": "B/s",
"description": "byte per second"
},
{
"unitId": "BytePerMinute",
"displayName": "byte per minute",
"displayNamePlural": "bytes per minute",
"symbol": "B/min",
"description": "byte per minute"
}
]
}
Example
In this example, the request lists all metric units available for the mySampleEnv environment.
The API token is passed in the Authorization header.
The result is truncated to three entries.
Curl
curl --request GET \
--url https://mySampleEnv.live.dynatrace.com/api/v2/units \
--header 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
Request URL
https://mySampleEnv.live.dynatrace.com/api/v2/units
Response body
{
"totalCount": 3,
"activeGateTokens": [
{
"unitId": "Second",
"displayName": "second",
"symbol": "s"
},
{
"unitId": "GigaBit",
"displayName": "gigabit",
"symbol": "Gbit"
},
{
"unitId": "KiloBytePerSecond",
"displayName": "kilobyte per second",
"symbol": "kB/s"
}
]
}
Response code
200