# Pagination not working and nextPageKey is null even after providing value of pageSize query param

**URL:** <https://community.dynatrace.com/t/pagination-not-working-and-nextpagekey-is-null-even-after-providing-value-of-pagesize-query-param/35624>\
**Category:** Dynatrace API\
**Tags:** hosts-classic\
**Created:** [June 28, 2022, 9:04am UTC](https://community.dynatrace.com/t/pagination-not-working-and-nextpagekey-is-null-even-after-providing-value-of-pagesize-query-param/35624 "2022-06-28T09:04:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![manjunathcr22](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@manjunathcr22](https://community.dynatrace.com/u/manjunathcr22)\
**Post date:** [June 28, 2022, 9:04am UTC](https://community.dynatrace.com/t/pagination-not-working-and-nextpagekey-is-null-even-after-providing-value-of-pagesize-query-param/35624/1 "2022-06-28T09:04:26Z")

</div>

[https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.gcpu.usage:names,builtin:host.cpu.msu.avg:names,builtin:host.cpu.msu.capacity:names,builtin:host.cpu.ziip.eligible:names,builtin:host.cpu.entConfig:names,&from=1652853660000&to=1652940060000&resolution=60m](https://xxxxxxxx.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin:host.cpu.gcpu.usage:names,builtin:host.cpu.msu.avg:names,builtin:host.cpu.msu.capacity:names,builtin:host.cpu.ziip.eligible:names,builtin:host.cpu.entConfig:names,&from=1652853660000&to=1652940060000&resolution=60m)

For above request we are getting 876KB of data.

So we need pagination support.

We are getting results like this without pageSize param.

{  
“totalCount”: 1292,  
“nextPageKey”: null,  
“resolution”: “1h”,  
…

}

Even in above uri if I add pageSize param with values 50,75 and 100 there is no change in response and size of data returned. Still nextPageKey is null.

How to make pagination working so that we get nextPageKey so that we can navigate using nextPageKey.

---

<div class="post-metadata">

**Author:** ![Radu](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/radu/32/23351_2.png) [@Radu](https://community.dynatrace.com/u/Radu)\
**Post date:** [June 28, 2022, 10:58am UTC](https://community.dynatrace.com/t/pagination-not-working-and-nextpagekey-is-null-even-after-providing-value-of-pagesize-query-param/35624/2 "2022-06-28T10:58:37Z")

</div>

Hi&nbsp;[@manjunathcr22](https://community.dynatrace.com/user/52493)

Pagination is not supported for this API.

As you can read in [the documentation](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/get-data-points#response-body-objects), the nextPageKey attribute is deprecated and only included in the JSON response for backwards compatibility purposes.

If the total payload you are extracting is too large, one suggestion is to break up the metric query into multiple queries (using the “from” and “to” query parameters to divide into smaller timeframes).

I hope this helps.

Radu
