Monitored entities API - GET entities list
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:
- Key requests.
- Top X requests that are used for baselining.
- Requests that have caused a problem.
You can limit the output by using the pagination:
- Specify the number of results per page in the pageSize query parameter.
- Then use the cursor from the nextPageKey field of the previous response in the nextPageKey query parameter to obtain subsequent pages.
The request produces an application/json
payload.
GET | ManagedDynatrace for Government | https://{your-domain}/e/{your-environment-id}/api/v2/entities |
SaaS | https://{your-environment-id}.live.dynatrace.com/api/v2/entities | |
Environment and Cluster ActiveGate (default port 9999) | https://{your-activegate-domain}:9999/e/{your-environment-id}/api/v2/entities |
Authentication
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.
Parameters
Parameter | Type | Description | In | Required |
---|---|---|---|---|
nextPageKey | string | 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. | query | optional |
pageSize | integer | The amount of entities. If not set, 50 is used. | query | optional |
entitySelector | string | Defines the scope of the query. Only entities matching the specified criteria are included into response. You must set one of these criteria:
You can add one or more of the following criteria. Values are case-sensitive and the
For more information, see Entity selector in Dynatrace Documentation. To set several criteria, separate them with a comma ( The maximum string length is 2,000 characters. The field is required when you're querying the first page of results. | query | optional |
from | string | The start of the requested timeframe. You can use one of the following formats:
If not set, the relative timeframe of three days is used ( | query | optional |
to | string | The end of the requested timeframe. You can use one of the following formats:
If not set, the current timestamp is used. | query | optional |
fields | string | 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 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 | query | optional |
sort | string | 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 | query | optional |
Response
Response codes
Code | Type | Description |
---|---|---|
200 | EntitiesList | Success |
Response body objects
The EntitiesList
object
A list of monitored entities along with their properties.
Element | Type | Description |
---|---|---|
entities | Entity[] | A list of monitored entities. |
nextPageKey | string | The cursor for the next page of results. Has the value of Use it in the nextPageKey query parameter to obtain subsequent pages of the result. |
pageSize | integer | The number of entries per page. |
totalCount | integer | The total number of entries in the result. |
The Entity
object
The properties of a monitored entity.
Element | Type | Description |
---|---|---|
displayName | string | The name of the entity, displayed in the UI. |
entityId | string | The ID of the entity. |
firstSeenTms | integer | The timestamp at which the entity was first seen, in UTC milliseconds. |
fromRelationships | object | A list of relationships where the entity occupies the FROM position. |
icon | EntityIcon | The icon of a monitored entity. |
lastSeenTms | integer | The timestamp at which the entity was last seen, in UTC milliseconds. |
managementZones | ManagementZone[] | A set of management zones to which the entity belongs. |
properties | object | A list of additional properties of the entity. |
tags | METag[] | A set of tags assigned to the entity. |
toRelationships | object | A list of relationships where the entity occupies the TO position. |
type | string | The type of the entity. |
The EntityId
object
A short representation of a monitored entity.
Element | Type | Description |
---|---|---|
id | string | The ID of the entity. |
type | string | The type of the entity. |
The EntityIcon
object
The icon of a monitored entity.
Element | Type | Description |
---|---|---|
customIconPath | string | The user-defined icon of the entity. Specify the barista ID of the icon or a URL of your own icon. |
primaryIconType | string | The primary icon of the entity. Specified by the barista ID of the icon. |
secondaryIconType | string | The secondary icon of the entity. Specified by the barista ID of the icon. |
The ManagementZone
object
A short representation of a management zone.
Element | Type | Description |
---|---|---|
id | string | The ID of the management zone. |
name | string | The name of the management zone. |
The METag
object
The tag of a monitored entity.
Element | Type | Description |
---|---|---|
context | string | The origin of the tag, such as AWS or Cloud Foundry. Custom tags use the |
key | string | The key of the tag. |
stringRepresentation | string | The string representation of the tag. |
value | string | The value of the tag. |
Response body JSON model
1{2 "entities": [3 {4 "displayName": "my host",5 "entityId": "HOST-06F288EE2A930951",6 "firstSeenTms": 1574697667547,7 "fromRelationships": {8 "isInstanceOf": [9 {10 "id": "HOST_GROUP-0E489369D663A4BF",11 "type": "HOST_GROUP"12 }13 ]14 },15 "icon": {16 "customIconPath": "host",17 "primaryIconType": "linux",18 "secondaryIconType": "microsoft-azure-signet"19 },20 "lastSeenTms": 1588242361417,21 "managementZones": [22 {23 "id": "6239538939987181652",24 "name": "main app"25 }26 ],27 "properties": {28 "bitness": 64,29 "cpuCores": 8,30 "monitoringMode": "FULL_STACK",31 "networkZoneId": "aws.us.east01",32 "osArchitecture": "X86",33 "osType": "LINUX"34 },35 "tags": [36 {37 "context": "CONTEXTLESS",38 "key": "architecture",39 "stringRepresentation": "architecture:x86",40 "value": "x86"41 },42 {43 "context": "ENVIRONMENT",44 "key": "Infrastructure",45 "stringRepresentation": "[ENVIRONMENT]Infrastructure:Linux",46 "value": "Linux"47 }48 ],49 "toRelationships": {50 "isDiskOf": [51 {52 "id": "DISK-0393340DCA3853B0",53 "type": "DISK"54 }55 ]56 },57 "type": "HOST"58 }59 ],60 "nextPageKey": "AQAAABQBAAAABQ==",61 "pageSize": 1,62 "totalCount": 163}
Example
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
1curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/entities?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)&fields=lastSeenTms,properties.serviceTechnologyTypes' \2-H 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'
Request URL
1https://mySampleEnv.live.dynatrace.com/api/v2/entities?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)&fields=lastSeenTms,properties.serviceTechnologyTypes
Response body
1{2 "totalCount": 52,3 "pageSize": 50,4 "nextPageKey": "AQArdHlwZSgiU0VSVklDRSIpL",5 "entities": [6 {7 "entityId": "SERVICE-1125C375A187D27A",8 "displayName": "dotNetBackend_easyTravel_x64",9 "lastSeenTms": 1590609632865,10 "properties": {11 "serviceTechnologyTypes": [12 "IIS app pool",13 "ASP.NET",14 "DotNet"15 ]16 }17 },18 {19 "entityId": "SERVICE-42C0B06C4DCFD0EF",20 "displayName": "AuthenticationService",21 "lastSeenTms": 1590747000977,22 "properties": {23 "serviceTechnologyTypes": [24 "Java"25 ]26 }27 },28 {29 "entityId": "SERVICE-620517BB99A7ED9E",30 "displayName": "BookingService",31 "lastSeenTms": 1590747028702,32 "properties": {33 "serviceTechnologyTypes": [34 "Java"35 ]36 }37 }38 ]39}
Response code
200