# V2 API Metrics Questions

**URL:** <https://community.dynatrace.com/t/v2-api-metrics-questions/36941>\
**Category:** Dynatrace API\
**Tags:** dynatrace-managed, dynatrace-api\
**Created:** [October 18, 2022, 2:15pm UTC](https://community.dynatrace.com/t/v2-api-metrics-questions/36941 "2022-10-18T14:15:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![louis\_gallo](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@louis\_gallo](https://community.dynatrace.com/u/louis_gallo)\
**Post date:** [October 18, 2022, 2:15pm UTC](https://community.dynatrace.com/t/v2-api-metrics-questions/36941/1 "2022-10-18T14:15:26Z")

</div>

In the Dynatrace V2 Metrics API, I have a few questions:

1) Can I set a time limit up for a DT V2 API query, or do I need to do that programmatically in my scripting? I ask because I would like it to timeout if a query is trying too hard or trying to return too much data.

2) Can I limit the amount of data that my API query will pull back? Once in a while, a query will return a huge amount of data.

3) Can I exclude certain data? For instance, when I pull disk data for a server, once in a while, I pull back an entity with thousands of disks from containers. I’d like to try and limit that in the query.

Any advice would be greatly appreciated.

Lou

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [October 19, 2022, 8:47am UTC](https://community.dynatrace.com/t/v2-api-metrics-questions/36941/2 "2022-10-19T08:47:42Z")

</div>

Hi&nbsp;[@louis\_gallo](https://community.dynatrace.com/user/34149)

1. IMO yes you should be handling timeouts, however the Dynatrace API will response with a 429 code in case it cannot process your request just yet. In that case I usually retry a couple of seconds later until my requests gets processed.
2. Some API Endpoints give you the option to set a pageSize in order to limit the amount of data you get back. Other than that you could also set from/to parameters for a shorter timeframe.
3. Again here you will find some endpoints let you specify an entitySelector to reduce the scope of your query. For your example I would use the entitySelector either directly in the metric query or through the entitySelector parameters e.g:

```markup
builtin:host.disk.free:filter(and(or(in("dt.entity.disk",entitySelector("type(disk),entityName.equals(~"/var/vcap/store~")"))))):splitBy("dt.entity.disk")

```

Hope this helps.

Best,  
Mark
