19 Sep 2025
12:14 PM
- last edited on
22 Sep 2025
08:11 AM
by
MaciejNeumann
Hello
I am trying to get the related entities of a specific service via the environment api. I am using the FromRelations.Calls relationship. I have read the documentation, but unfortunately i am not able to make it work.
This is what i am trying to execute.
curl -X 'GET' \ 'https://#########blanked out########/api/v2/entities?entitySelector=fromRelationships.Calls%28entityId%28SERVICE-1AAA4F%29%29' \ -H 'accept: application/json; charset=utf-8' \ -H 'Authorization: Api-Token ####blanked out####'
output is
{ "error": { "code": 400, "message": "Constraints violated.", "constraintViolations": [ { "path": "entitySelector", "message": "The entitySelector parameter must contain entity type information on all levels, not determinable on level with values: fromrelationships.calls", "parameterLocation": "QUERY", "location": null } ] } }
Can someone try to help me out here with the syntax? Thank you in advance!
Solved! Go to Solution.
19 Sep 2025 02:01 PM
Hi,
I am using this and I can see relations in the output:
curl -X 'GET' \
'https://XXXXX.live.dynatrace.com/api/v2/entities/SERVICE-XXXXX' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token XXXXX'
Best regards
19 Sep 2025 02:22 PM
I haven't tested it, but it seems it wants to get type information, hence something like entityselector=type(SERVICE),fromRelationships.Calls(...) , to determine the base type it needs to query...
As mentioned, not tested but my first though...
22 Sep 2025 06:36 AM
i found it. thanks for the insight
$CurlArgument = 'X', 'GET', 'https://################/api/v2/entities?entitySelector=type%28SERVICE%29%2Cfromrelationships.calls%28entityID%28SERVICE-5123456789EF%29%29',
'-H', 'accept: application/json; charset=utf-8', '-H', 'Authorization: Api-Token ####################'