# How to use entity selector to filter only by host name?

**URL:** <https://community.dynatrace.com/t/how-to-use-entity-selector-to-filter-only-by-host-name/31723>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [June 7, 2021, 10:31am UTC](https://community.dynatrace.com/t/how-to-use-entity-selector-to-filter-only-by-host-name/31723 "2021-06-07T10:31:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek\_jawand](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@abhishek\_jawand](https://community.dynatrace.com/u/abhishek_jawand)\
**Post date:** [June 7, 2021, 10:31am UTC](https://community.dynatrace.com/t/how-to-use-entity-selector-to-filter-only-by-host-name/31723/1 "2021-06-07T10:31:47Z")

</div>

Hi,

Kindly let me know how to use entity selector to filter only by host name, currently below API is working but need to add entity selector with host name,

https://{}.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:tech.websphere.connectionPool.connectionPoolModule.PercentUsed:Avg:parents:names&api-token=xxx&resolution=INF&from=2021-04-20T11:00-05:00&to=2021-04-20T12:00-05:00

Regards,

Sivesh Kumar R

---

<div class="post-metadata">

**Author:** ![Mo\_Azuz](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mo_azuz/32/5921_2.png) [@Mo\_Azuz](https://community.dynatrace.com/u/Mo_Azuz)\
**Post date:** [June 7, 2021, 7:57pm UTC](https://community.dynatrace.com/t/how-to-use-entity-selector-to-filter-only-by-host-name/31723/2 "2021-06-07T19:57:24Z")

</div>

Hi Sivesh,

Check the _entity_ parameter to specify the host/hosts, full list of host parameters can be found here [Hosts API - GET all hosts — Dynatrace Docs](https://www.dynatrace.com/support/help/shortlink/api-hosts-get-all#parameters)

 ![Moe_0-1623095425408.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/c/2c16b0218d30e6dc65dd45f8c6cdd2a75935c873.png)

---

<div class="post-metadata">

**Author:** ![adam\_gardner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/adam_gardner/32/20087_2.png) [@adam\_gardner](https://community.dynatrace.com/u/adam_gardner)\
**Post date:** [June 7, 2021, 9:55pm UTC](https://community.dynatrace.com/t/how-to-use-entity-selector-to-filter-only-by-host-name/31723/3 "2021-06-07T21:55:21Z")

</div>

I’d recommend implementing a robust tagging strategy then filtering by tag, it’s much more flexible than filtering by the static host ID. Your future self will thank you 🙂

```markup
type("HOST"),tag(app:myapplication)

```

---

<div class="post-metadata">

**Author:** ![dhanunjaya\_kadi](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@dhanunjaya\_kadi](https://community.dynatrace.com/u/dhanunjaya_kadi)\
**Post date:** [August 20, 2021, 1:35pm UTC](https://community.dynatrace.com/t/how-to-use-entity-selector-to-filter-only-by-host-name/31723/4 "2021-08-20T13:35:55Z")

</div>

How to Tag Host and all related services and processes using entity selector.

like in autotagging we will check apply to underlying hosts/process groups.
