# API call for OneAgent using tags

**URL:** <https://community.dynatrace.com/t/api-call-for-oneagent-using-tags/47839>\
**Category:** Open Q&A\
**Tags:** dynatrace-api\
**Created:** [September 19, 2024, 6:02pm UTC](https://community.dynatrace.com/t/api-call-for-oneagent-using-tags/47839 "2024-09-19T18:02:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![GilesDay](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gilesday/32/35068_2.png) [@GilesDay](https://community.dynatrace.com/u/GilesDay)\
**Post date:** [September 19, 2024, 6:11pm UTC](https://community.dynatrace.com/t/api-call-for-oneagent-using-tags/47839/2 "2024-09-19T18:11:09Z")

</div>

Try this:

[GitHub - dynatrace-oss/api-client-python: Dynatrace API Python client](https://github.com/dynatrace-oss/api-client-python)

```markup
from dynatrace import Dynatrace
from dynatrace import TOO_MANY_REQUESTS_WAIT
from dynatrace.environment_v2.tokens_api import SCOPE_METRICS_READ, SCOPE_METRICS_INGEST
from dynatrace.configuration_v1.credential_vault import PublicCertificateCredentials
from dynatrace.environment_v2.settings import SettingsObject, SettingsObjectCreate

from datetime import datetime, timedelta

# Create a Dynatrace client
dt = Dynatrace("environment_url", "api_token")

# Get all hosts and some properties
for entity in dt.entities.list('type("HOST"),tag("AppID:104378")'):
    print(entity.entity_id, entity.display_name, entity.properties)

```

---

_[View the full topic](https://community.dynatrace.com/t/api-call-for-oneagent-using-tags/47839)._
