Hello,
It seems that it’s no longer possible to view an entity’s properties using the v2 API (/entities) - see image.
Do you have an example of a DQL query that returns all the properties as the API used to?
We have scripts that make API calls. Will this be deprecated in the near future?
Thanks
Hi,
Properties field is being returned using Monitored entities API - GET entities list.
Best regards
Hi,
Yes — in Dynatrace SaaS the direction is to replace the classic “Monitored entities / Manage monitored entities” API usage with DQL + Smartscape on Grail (and OpenPipeline where applicable). That’s why you see it marked as Deprecated
IMO, u can use DQL to discover which fields/properties exist for an entity type.
Look here:
This returns the available fields you can later add via fieldsAdd.
Then you can fetch entities of a given type and add the properties you need.
Another TRICK and TIPS. If you want “all types” (topology-style):
smartscapeNodes "*"
| limit 100
That’s the “show me nodes regardless of type” approach in Smartscape on Grail.
Her u have links, with u can check:
ANd this what @AntonPineiro send
Monitored entities API - GET entities list.
It’s not clear to me how one would replace existing API calls to “api/v2/entities?entitySelector=type…” with “DQL and SmartScape”
Me neither. I find it much more complex to retrieve the information we had in the API’s JSON.
Especially when we could use the entity ID and get its configuration. It seems more complex to do in DQL.
Is there an existing endpoint where we can send DQL queries already and I just don’t know about it? I’m with the other folks here and don’t understand how we are supposed to query for monitored entities from outside of Dynatrace with all of our existing automations and external reporting tools that leverage this API endpoint.
On a related note, if you could create a /dql_query=“fetch …” endpoint that would be awesome!
@LordNykkon the Grail Query Platform API is located at https://<environment>.apps.dynatrace.com/platform/swagger-ui/index.html?urls.primaryName=Grail±+DQL+Query#/Query%20Execution/query%3Aexecute (swagger).
The API endpoint itself is https://<environment>.apps.dynatrace.com/platform/storage/query/v1/query:execute
You need either OAuth client or a Platform token to access this platform API.
Further docs - Access platform APIs from outside | Dynatrace Developer
Grail DQL query API | Dynatrace Developer
Actually, it not that difficult, but requires a little bit more work:
curl -X 'POST' \
'https://<YOUR_ENVIRONMENT>.apps.dynatrace.com/platform/storage/query/v1/query:execute' \
-H 'accept: application/json' \
-H 'enforce-query-consumption-limit: true' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <YOUR_TOKEN>' \
-d '{
"query": "fetch dt.entity.host | limit 10",
"requestTimeoutMilliseconds": 1000
}'
For scripting (especially shell scripting), I’d consider using dtctl instead GitHub - Dynatrace/dtctl: CLI for managing Dynatrace platform resources - built for humans and AI agents · GitHub :
$ dtctl query "fetch dt.entity.host"
ENTITY NAME ID
node2.xxxx HOST-CCA6561347DAAA74
app02.yyy HOST-7EA1B005A5DDECED
And it allows you to format to yaml/json too, similar to kubectl.