# filter based on entityName

**URL:** <https://community.dynatrace.com/t/filter-based-on-entityname/47192>\
**Category:** Dynatrace API\
**Tags:** entity-selector, dynatrace-api\
**Created:** [August 19, 2024, 9:28am UTC](https://community.dynatrace.com/t/filter-based-on-entityname/47192 "2024-08-19T09:28:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cky007](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@Cky007](https://community.dynatrace.com/u/Cky007)\
**Post date:** [August 19, 2024, 9:28am UTC](https://community.dynatrace.com/t/filter-based-on-entityname/47192/1 "2024-08-19T09:28:04Z")

</div>

While I trying to filter the entities based on entityName I’m not able to fetch with https://{your-environment}/api/v2/metrics/query?entitySelector=entityname.equals(%22{entityname}%22). with this api I’m not able to fetch the entites so help me out to fetch the entites on base of entityName.

---

<div class="post-metadata">

**Author:** ![Venkata\_Sainath\_Ghanachari](https://avatars.discourse-cdn.com/v4/letter/v/3ab097/32.png) [@Venkata\_Sainath\_Ghanachari](https://community.dynatrace.com/u/Venkata_Sainath_Ghanachari)\
**Post date:** [August 19, 2024, 9:43am UTC](https://community.dynatrace.com/t/filter-based-on-entityname/47192/2 "2024-08-19T09:43:56Z")

</div>

[@Cky007](https://community.dynatrace.com/user/79551) , your trying use metric query API, where you pull the metric values.

To Fetch Entitles and entity details you may need to use below APIs

> **[Monitored entities API - GET entities list](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/get-entities-list)**
>
> View a list of monitored entities via Dynatrace API.

> **[Monitored entities API - GET an entity](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/get-entity)**
>
> View parameters of a monitored entity via Dynatrace API.

Regards,

Venkat

---

<div class="post-metadata">

**Author:** ![Cky007](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@Cky007](https://community.dynatrace.com/u/Cky007)\
**Post date:** [August 19, 2024, 9:56am UTC](https://community.dynatrace.com/t/filter-based-on-entityname/47192/3 "2024-08-19T09:56:14Z")

</div>

But with the metric query I pulled entityID data. If possible share me an sample url with entityName function

and entitySelector parameter

---

<div class="post-metadata">

**Author:** ![Cky007](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@Cky007](https://community.dynatrace.com/u/Cky007)\
**Post date:** [August 19, 2024, 10:01am UTC](https://community.dynatrace.com/t/filter-based-on-entityname/47192/4 "2024-08-19T10:01:40Z")

</div>

curl -L -X GET ‘https://{environmentid}.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.(usage,idle)&entitySelector=type(%22dt.entity.host%22),entityId(%22HOST-0990886B7D39FE29%22,%22HOST-0956C3557E9109C1%22)&from=now-5m’ \  
-H ‘Authorization: Api-Token abcdefjhij1234567890’ \  
-H ‘Accept: application/json’  
With the help of entityId i can retrive right
