Dynatrace API
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to fetch all entities?

mango_byte
Visitor

Hi, I am trying to fetch all entities as mentioned on official documentation https://{environmentid}.live.dynatrace.com/api/v2/entities 

and getting response: 

{
"error": {
"code": 400,
"message": "Constraints violated.",
"constraintViolations": [
{
"path": "entitySelector",
"message": "must be set if next-page-key is not defined",
"parameterLocation": "QUERY",
"location": null
}
]
}
}
Kindly help in clarifying where I am wrong and how to fetch all entities?
Thanks
3 REPLIES 3

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

I think you are missing entitySelector:

curl -X 'GET' \
  'https://XXXXXXXXXX.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22HOST%22%29' \
  -H 'accept: application/json; charset=utf-8' \
  -H 'Authorization: Api-Token XXXXXXXXXX'

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Khalid_Alkhouli
Visitor

This only gets HOST entities, not all entities. Shouldn't there be like a wildcard to use to include all entities?

@Khalid_Alkhouli , no the Dynatrace Classic API requires an entityType. You can loop through the available entities using get entity types API and fetch those entity per type. It's not possible to return multiple entity types in one query.

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts