Related entities of a specific service through the environment API V2

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.

<span>curl -X </span><span>'GET'</span><span> \</span>  <span>'https://#########blanked out########/api/v2/entities?entitySelector=fromRelationships.Calls%28entityId%28SERVICE-1AAA4F%29%29'</span><span> \</span><span>  -H </span><span>'accept: application/json; charset=utf-8'</span><span> \</span><span>  -H </span><span>'Authorization: Api-Token ####blanked out####'</span>

output is

<span>{</span>  <span class="">"error"</span><span>: {</span>    <span class="">"code"</span><span>: </span><span>400</span><span>,</span>    <span class="">"message"</span><span>: </span><span>"Constraints violated."</span><span>,</span>    <span class="">"constraintViolations"</span><span>: [</span>      {
        <span class="">"path"</span><span>: </span><span>"entitySelector"</span><span>,</span>        <span class="">"message"</span><span>: </span><span>"The entitySelector parameter must contain entity type information on all levels, not determinable on level with values: fromrelationships.calls"</span><span>,</span>        <span class="">"parameterLocation"</span><span>: </span><span>"QUERY"</span><span>,</span>        <span class="">"location"</span><span>: </span><span>null</span>
      }
    ]
  }
}

Can someone try to help me out here with the syntax? Thank you in advance!

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

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…

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