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

Help making an API call with entitySelector

adtuser
Frequent Guest

Hi Dynatrace, 
Can you please provide some guidance how to use entitySelector to retrieve host data by host name? 

I tried different options but none successful. Here is one example:

.../api/v2/entities?entitySelector=type('host'),tag('Hostname:xxxxxx')
Note: I can retrieve the host info by entityId using 
entities/{entityId} but that means I need to retrieve and/or maintain a separate map of hostnames to entityIds. 
Also, do you have more info about how to interpret API error messages?
Ex: what should I understand from this output? 
{
"error": {
"code": 400,
"message": "Constraints violated.",
"constraintViolations": [
{
"path": "entitySelector",
"message": "The requested type is not exportable",
"parameterLocation": "QUERY",
"location": null
}
]
}
}

Thank you


2 REPLIES 2

dannemca
DynaMight Mentor
DynaMight Mentor

The problem is the single quote you are using on the filter.
try with double quotes. entitySelector=type("host"),tag("your:tag")

 

Site Reliability Engineer @ Kyndryl

Thank you! That was it.