Lists entities observed within the specified timeframe along with their properties. When you query entities of the SERVICE_METHOD
type, only the following requests are returned:
You can limit the output by using the pagination:
The request produces an application/json
payload.
GET | SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/entities |
Environment ActiveGateCluster ActiveGate | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/entities |
To execute this request, you need an access token with entities.read
scope.
To learn how to obtain and use it, see Tokens and authentication.
The cursor for the next page of results. You can find it in the nextPageKey field of the previous response.
The first page is always returned if you don't specify the nextPageKey query parameter.
When the nextPageKey is set to obtain subsequent pages, you must omit all other query parameters.
The amount of entities.
If not set, 50 is used.
Defines the scope of the query. Only entities matching the specified criteria are included into response.
You must set one of these criteria:
type("TYPE")
entityId("id")
. You can specify several IDs, separated by a comma (entityId("id-1","id-2")
). All requested entities must be of the same type.You can add one or more of the following criteria. Values are case-sensitive and the EQUALS
operator is used unless otherwise specified.
tag("value")
. Tags in [context]key:value
, key:value
, and value
formats are detected and parsed automatically. Any colons (:
) that are part of the key or value must be escaped with a backslash(\
). Otherwise, it will be interpreted as the separator between the key and the value. All tag values are case-sensitive.mzId(123)
mzName("value")
entityName.equals
: performs a non-casesensitive EQUALS
query.entityName.startsWith
: changes the operator to BEGINS WITH
.entityName.in
: enables you to provide multiple values. The EQUALS
operator applies.caseSensitive(entityName.equals("value"))
: takes any entity name criterion as an argument and makes the value case-sensitive.healthState("HEALTHY")
firstSeenTms.<operator>(now-3h)
. Use any timestamp format from the from/to parameters.
The following operators are available:
lte
: earlier than or at the specified timelt
: earlier than the specified timegte
: later than or at the specified timegt
: later than the specified time<attribute>("value1","value2")
and <attribute>.exists()
. To fetch the list of available attributes, execute the GET entity type request and check the properties field of the response.fromRelationships.<relationshipName>()
and toRelationships.<relationshipName>()
. This criterion takes an entity selector as an attribute. To fetch the list of available relationships, execute the GET entity type request and check the fromRelationships and toRelationships fields.not(<criterion>)
. Inverts any criterion except for type.For more information, see Entity selector in Dynatrace Documentation.
To set several criteria, separate them with a comma (,
). For example, type("HOST"),healthState("HEALTHY")
. Only results matching all criteria are included in the response.
The maximum string length is 2,000 characters.
The field is required when you're querying the first page of results.
The start of the requested timeframe.
You can use one of the following formats:
2021-01-25T05:57:01.123+01:00
. If no time zone is specified, UTC is used. You can use a space character instead of the T
. Seconds and fractions of a second are optional.now-NU/A
, where N
is the amount of time, U
is the unit of time, and A
is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w
is one year back, aligned by a week.
You can also specify relative timeframe without an alignment: now-NU
.
Supported time units for the relative timeframe are:
m
: minutesh
: hoursd
: daysw
: weeksM
: monthsy
: yearsIf not set, the relative timeframe of three days is used (now-3d
).
The end of the requested timeframe.
You can use one of the following formats:
2021-01-25T05:57:01.123+01:00
. If no time zone is specified, UTC is used. You can use a space character instead of the T
. Seconds and fractions of a second are optional.now-NU/A
, where N
is the amount of time, U
is the unit of time, and A
is an alignment. The alignment rounds all the smaller values to the nearest zero in the past. For example, now-1y/w
is one year back, aligned by a week.
You can also specify relative timeframe without an alignment: now-NU
.
Supported time units for the relative timeframe are:
m
: minutesh
: hoursd
: daysw
: weeksM
: monthsy
: yearsIf not set, the current timestamp is used.
Defines the list of entity properties included in the response. The ID and the name of an entity are always included to the response.
To add properties, list them with leading plus +
. You can specify several properties, separated by a comma (for example fields=+lastSeenTms,+properties.BITNESS
).
Use the GET entity type request to fetch the list of properties available for your entity type. Fields from the properties object must be specified in the properties.FIELD
format (for example, properties.BITNESS
).
When requesting large amounts of relationship fields, throttling can apply.
Defines the ordering of the entities returned.
This field is optional, each field has a sign prefix (+/-), which corresponds to sorting order ( + for ascending and - for descending). If no sign prefix is set, then default ascending sorting order will be applied.
Currently ordering is only available for the display name (for example sort=name or sort =+name for ascending, sort=-name for descending
)
EntitiesList
objectA list of monitored entities along with their properties.
The cursor for the next page of results. Has the value of null
on the last page.
Use it in the nextPageKey query parameter to obtain subsequent pages of the result.
The number of entries per page.
The total number of entries in the result.
Entity
objectThe properties of a monitored entity.
The name of the entity, displayed in the UI.
The ID of the entity.
The timestamp at which the entity was first seen, in UTC milliseconds.
A list of relationships where the entity occupies the FROM position.
The timestamp at which the entity was last seen, in UTC milliseconds.
A list of additional properties of the entity.
A list of relationships where the entity occupies the TO position.
The type of the entity.
EntityId
objectA short representation of a monitored entity.
The ID of the entity.
The type of the entity.
EntityIcon
objectThe icon of a monitored entity.
The user-defined icon of the entity.
Specify the barista ID of the icon or a URL of your own icon.
ManagementZone
objectA short representation of a management zone.
The ID of the management zone.
The name of the management zone.
METag
objectThe tag of a monitored entity.
The origin of the tag, such as AWS or Cloud Foundry.
Custom tags use the CONTEXTLESS
value.
The key of the tag.
The string representation of the tag.
The value of the tag.
{"entities": [{"displayName": "my host","entityId": "HOST-06F288EE2A930951","firstSeenTms": 1574697667547,"fromRelationships": {"isInstanceOf": [{"id": "HOST_GROUP-0E489369D663A4BF","type": "HOST_GROUP"}]},"icon": {"customIconPath": "host","primaryIconType": "linux","secondaryIconType": "microsoft-azure-signet"},"lastSeenTms": 1588242361417,"managementZones": [{"id": "6239538939987181652","name": "main app"}],"properties": {"bitness": 64,"cpuCores": 8,"monitoringMode": "FULL_STACK","networkZoneId": "aws.us.east01","osArchitecture": "X86","osType": "LINUX"},"tags": [{"context": "CONTEXTLESS","key": "architecture","stringRepresentation": "architecture:x86","value": "x86"},{"context": "ENVIRONMENT","key": "Infrastructure","stringRepresentation": "[ENVIRONMENT]Infrastructure:Linux","value": "Linux"}],"toRelationships": {"isDiskOf": [{"id": "DISK-0393340DCA3853B0","type": "DISK"}]},"type": "HOST"}],"nextPageKey": "AQAAABQBAAAABQ==","pageSize": 1,"totalCount": 1}
In this example, the request list services that belong to the management zones with the ID of 229130632296508575249. To achieve that, the entitySelector query parameter is set to type("SERVICE"),mzId("229130632296508575249")
.
Apart from default Dynatrace entity IDs and names of the entities, the request also returns the timestamp of when the service was last seen and the list of technology types that run in the service. To achieve that, the fields query parameter is set to lastSeenTms,properties.serviceTechnologyTypes
.
The API token is passed in the Authorization header.
The result is truncated to three entries.
curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/entities?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)&fields=lastSeenTms,properties.serviceTechnologyTypes' \-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
https://mySampleEnv.live.dynatrace.com/api/v2/entities?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)&fields=lastSeenTms,properties.serviceTechnologyTypes
{"totalCount": 52,"pageSize": 50,"nextPageKey": "AQArdHlwZSgiU0VSVklDRSIpL","entities": [{"entityId": "SERVICE-1125C375A187D27A","displayName": "dotNetBackend_easyTravel_x64","lastSeenTms": 1590609632865,"properties": {"serviceTechnologyTypes": ["IIS app pool","ASP.NET","DotNet"]}},{"entityId": "SERVICE-42C0B06C4DCFD0EF","displayName": "AuthenticationService","lastSeenTms": 1590747000977,"properties": {"serviceTechnologyTypes": ["Java"]}},{"entityId": "SERVICE-620517BB99A7ED9E","displayName": "BookingService","lastSeenTms": 1590747028702,"properties": {"serviceTechnologyTypes": ["Java"]}}]}
200