# Environment Issue - fetching entityType and entityName metrics from one environment

**URL:** <https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333>\
**Category:** Dynatrace API\
**Tags:** dynatrace-managed, dynatrace-api\
**Created:** [August 27, 2024, 5:27am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333 "2024-08-27T05:27:39Z")\
**Posts on this page:** 6\
**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 27, 2024, 5:27am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333/1 "2024-08-27T05:27:39Z")

</div>

when I’m try to fetch the metrics with the help of entityType and entityName I’m getting all the details across the environment I need a param to fetch the environment on which I mention.

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [August 27, 2024, 6:35am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333/2 "2024-08-27T06:35:30Z")

</div>

Hello&nbsp;[@Cky007](https://community.dynatrace.com/user/79551)

There are three unique syntax and value operators associated with the **entityName**. Which one did you employ?

 ![Babar_Qayyum_0-1724740388184.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/1/912bf9bb05a74f992c9cd34d8d70d919b471b2cc.png)

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![wouterdt](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wouterdt/32/25147_2.png) [@wouterdt](https://community.dynatrace.com/u/wouterdt)\
**Post date:** [August 27, 2024, 8:17am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333/3 "2024-08-27T08:17:16Z")

</div>

either your entities in dynatrace have some kind of naming convention that hopefully is compatible with the entityselector or you’ll have to setup tags on the entities to select them. Management zones can be useful too

> **[Management zone ID - Environment API v2 - Entity selector](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/entity-v2/entity-selector#mzid)**
>
> The entity selector is a powerful instrument for specifying which entities you want to include in the scope of your Environment API v2 calls. It is used in several APIs, so you only have to learn the syntax once and then reuse it for multiple use...

```markup
Type("HOST"),tag("environment:production")
Type("HOST"),entityName.startsWith("Prod")

```

---

<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 27, 2024, 8:39am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333/4 "2024-08-27T08:39:00Z")

</div>

I use entitySelector=entityName.equals(“name”)

---

<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 27, 2024, 8:39am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333/5 "2024-08-27T08:39:59Z")

</div>

For setting up tags where I need to make changes for Json body

---

<div class="post-metadata">

**Author:** ![wouterdt](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wouterdt/32/25147_2.png) [@wouterdt](https://community.dynatrace.com/u/wouterdt)\
**Post date:** [August 27, 2024, 8:41am UTC](https://community.dynatrace.com/t/environment-issue-fetching-entitytype-and-entityname-metrics-from-one-environment/47333/6 "2024-08-27T08:41:08Z")

</div>

> **[Define and apply tags](https://docs.dynatrace.com/docs/manage/tags-and-metadata/setup/how-to-define-tags)**
>
> Define and apply tags manually or automatically to organize Dynatrace entities, using rule conditions based on entity properties and regular expressions.

you need to define tags in settings
