Monitored entities API - GET entities list
Lists entities observed within the specified timeframe along with their properties.
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.
This request is an Early Adopter release and may be changed in non-compatible way.
GET |
|
Authentication
To execute this request, you need the Read entities (entities.read
) permission assigned to your API token. 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 need to set one of these criteria:
And you can add one or several of the following criteria. Values are case-sensitive and the
Further information can be found here.
To set several criteria, separate them with a comma ( The length of the string is limited to 10,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 /entityTypes/{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 |
Response
Response codes
Code | Description |
---|---|
200 | Success |
Response body
The EntitiesList object
A list of monitored entities along with their properties.
Element | Type | Description |
---|---|---|
totalCount | integer | The total number of entries in the result. |
pageSize | integer | The number of entries per page. |
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. |
entities | Entity[] | A list of monitored entities. |
The Entity object
The properties of a monitored entity.
Element | Type | Description |
---|---|---|
toRelationships | object | A list of relationships where the entity occupies the TO position. |
tags | METag[] | A set of tags assigned to the entity. |
managementZones | ManagementZone[] | A set of management zones to which the entity belongs. |
entityId | string | The ID of the entity. |
lastSeenTms | integer | The timestamp at which the entity was last seen, in UTC milliseconds. |
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. |
properties | object | A list of additional properties of the entity. |
displayName | string | The name of the entity, displayed in the UI. |
The ManagementZone object
A short representation of a management zone.
Element | Type | Description |
---|---|---|
name | string | The name of the management zone. |
id | string | The ID of the management zone. |
The METag object
The tag of a monitored entity.
Element | Type | Description |
---|---|---|
stringRepresentation | string | The string representation of the tag. |
value | string | The value of the tag. |
key | string | The key of the tag. |
context | string | The origin of the tag, such as AWS or Cloud Foundry. Custom tags use the |
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. |
{
"totalCount": 0,
"pageSize": 0,
"nextPageKey": "AQAAABQBAAAABQ==",
"entities": [
{
"entityId": "HOST-06F288EE2A930951",
"displayName": "my host",
"firstSeenTms": 1574697667547,
"lastSeenTms": 1588242361417,
"properties": {
"bitness": 64,
"monitoringMode": "FULL_STACK",
"osType": "LINUX",
"osArchitecture": "X86",
"networkZoneId": "aws.us.east01",
"cpuCores": 8
},
"tags": [
{
"context": "CONTEXTLESS",
"key": "architecture",
"value": "x86",
"stringRepresentation": "architecture:x86"
},
{
"context": "ENVIRONMENT",
"key": "Infrastructure",
"value": "Linux",
"stringRepresentation": "[ENVIRONMENT]Infrastructure:Linux"
}
],
"managementZones": [
{
"id": "6239538939987181652",
"name": "main app"
}
],
"fromRelationships": {
"isInstanceOf": [
{
"id": "HOST_GROUP-0E489369D663A4BF",
"type": "HOST_GROUP"
}
]
},
"toRelationships": {
"isDiskOf": [
{
"id": "DISK-0393340DCA3853B0",
"type": "DISK"
}
]
}
}
]
}
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("9130632296508575249")
.
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
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 abcdefjhij1234567890'
Request URL
https://mySampleEnv.live.dynatrace.com/api/v2/entities?entitySelector=type(%22SERVICE%22),mzId(%229130632296508575249%22)&fields=lastSeenTms,properties.serviceTechnologyTypes
Response body
{
"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"
]
}
}
]
}
Response code
200