# Help making an API call with entitySelector

**URL:** <https://community.dynatrace.com/t/help-making-an-api-call-with-entityselector/34669>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [March 30, 2022, 1:32pm UTC](https://community.dynatrace.com/t/help-making-an-api-call-with-entityselector/34669 "2022-03-30T13:32:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adtuser](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@adtuser](https://community.dynatrace.com/u/adtuser)\
**Post date:** [March 30, 2022, 1:32pm UTC](https://community.dynatrace.com/t/help-making-an-api-call-with-entityselector/34669/1 "2022-03-30T13:32:22Z")

</div>

Hi Dynatrace,&nbsp;  
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&nbsp;entities/{entityId} but that means I need to retrieve and/or maintain a separate map of hostnames to entityIds.&nbsp;  
Also, do you have more info about how to interpret API error messages?  
Ex: what should I understand from this output?&nbsp;  
{  
“error”: {  
“code”: 400,  
“message”: “Constraints violated.”,  
“constraintViolations”: [  
{  
“path”: “entitySelector”,  
“message”: “The requested type is not exportable”,  
“parameterLocation”: “QUERY”,  
“location”: null  
}  
]  
}  
}

Thank you

---

<div class="post-metadata">

**Author:** ![dannemca](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dannemca/32/7215_2.png) [@dannemca](https://community.dynatrace.com/u/dannemca)\
**Post date:** [March 30, 2022, 1:48pm UTC](https://community.dynatrace.com/t/help-making-an-api-call-with-entityselector/34669/2 "2022-03-30T13:48:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adtuser](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@adtuser](https://community.dynatrace.com/u/adtuser)\
**Post date:** [March 30, 2022, 2:23pm UTC](https://community.dynatrace.com/t/help-making-an-api-call-with-entityselector/34669/3 "2022-03-30T14:23:55Z")

</div>

Thank you! That was it.
