# Get host entity filter by monitoring mode

**URL:** <https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [August 17, 2021, 3:38pm UTC](https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428 "2021-08-17T15:38:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ousti](https://avatars.discourse-cdn.com/v4/letter/o/c6cbf5/32.png) [@Ousti](https://community.dynatrace.com/u/Ousti)\
**Post date:** [August 17, 2021, 3:38pm UTC](https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428/1 "2021-08-17T15:38:22Z")

</div>

I’m calling v2 entities api for selectig hosts machines with infrastructure mode. I met a problem with the query syntax for attribute params in entitySelectorField.

my Syntax is : **entitySelector=type(“HOST”),\<monitoringMode\>(“INFRASTRUCTURE”)** according to the documentation but it return a 400 response.

```auto
{
  "error": {
    "code": 400,
    "message": "Constraints violated.",
    "constraintViolations": [
      {
        "path": "entitySelector",
        "message": "Unknown predicate name <monitoringMode>",
        "parameterLocation": "QUERY",
        "location": null
      },
      {
        "path": "entitySelector",
        "message": "Unknown predicate name <monitoringMode>",
        "parameterLocation": "QUERY",
        "location": null
      }
    ]
  }
}

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![ryan\_ott](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ryan_ott/32/15818_2.png) [@ryan\_ott](https://community.dynatrace.com/u/ryan_ott)\
**Post date:** [August 17, 2021, 8:14pm UTC](https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428/2 "2021-08-17T20:14:39Z")

</div>

**EDIT:** &nbsp;Deleted the first half of this response as I was incorrect. You are able to achieve this using monitoringMode(“CLOUD\_INFRA”). Leaving the second half of this response as it may still serve the purpose using a different API endpoint.

---

For what you are trying to achieve, might I suggest using the OneAgent on a Host API. You can create an API query such as this to pull a list of all hosts that are in Infrastructure monitoring mode:

https://{environmentURL}/api/v1/oneagents?includeDetails=true&monitoringType=CLOUD\_INFRASTRUCTURE

More information on this API endpoint can be found here:&nbsp;[https://www.dynatrace.com/support/help/shortlink/api-oneagent-on-host](https://www.dynatrace.com/support/help/shortlink/api-oneagent-on-host)

Hope this helps!

-Ryan

---

<div class="post-metadata">

**Author:** ![Ousti](https://avatars.discourse-cdn.com/v4/letter/o/c6cbf5/32.png) [@Ousti](https://community.dynatrace.com/u/Ousti)\
**Post date:** [August 18, 2021, 7:23am UTC](https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428/3 "2021-08-18T07:23:59Z")

</div>

Hi Ryan,

Thanks for your reponse. Entity Attribute can’t achieve this need ?

=\> The attribute name—attribute value pair that the requested entity should have.

To specify several attribute values, separate them with commas (,).

To fetch the list of available attributes, execute the&nbsp;[GET entity type](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/entity-v2/get-entity-type/)&nbsp;call and check the&nbsp; **properties** &nbsp;field. You can use attributes with values that can be represented by a string.

We have monitoringMode in the properties list on the host so i thought it was possible.

Thanks again Ryan

---

<div class="post-metadata">

**Author:** ![Ousti](https://avatars.discourse-cdn.com/v4/letter/o/c6cbf5/32.png) [@Ousti](https://community.dynatrace.com/u/Ousti)\
**Post date:** [August 18, 2021, 8:35am UTC](https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428/4 "2021-08-18T08:35:02Z")

</div>

Ryan,

type(“HOST”),monitoringMode(“CLOUD\_INFRA”) is OK.

The value of monitoringMode can’t be CLOUD\_INFRASTRUCTURE or INFRASTRUCTURE

Thanks

---

<div class="post-metadata">

**Author:** ![ryan\_ott](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ryan_ott/32/15818_2.png) [@ryan\_ott](https://community.dynatrace.com/u/ryan_ott)\
**Post date:** [August 18, 2021, 12:20pm UTC](https://community.dynatrace.com/t/get-host-entity-filter-by-monitoring-mode/32428/5 "2021-08-18T12:20:47Z")

</div>

You are correct - my apologies for the confusion. You learn something new every day&nbsp;:slightly\_smiling\_face:&nbsp; I have edited my reply.
