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

Get related entities of a specific service through the environment api V2.

svendb1803
Newcomer

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!

 

3 REPLIES 3

AntonPineiro
DynaMight Guru
DynaMight Guru

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

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

SjoerdB
Mentor

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...

 

Dynatrace Certified Professional | Dynatrace partner IctCoreBiz B.V.

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 ####################'

Featured Posts