# Clarifications on use of &page URL parameter

**URL:** https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158
**Category:** Development
**Tags:** rest-api
**Created:** [2018年一月3日 10:03 UTC](https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158 "2018-01-03T10:03:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [2018年一月3日 10:03 UTC](https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158/1 "2018-01-03T10:03:25Z")

</div>

First time poster, so forgive me if I am doing this entirely wrong.

I was trying to pull down our users via `https://discuss.elastic.co/admin/users/list/all.json?api_key=KEY&api_username=USER` which is working fine. However I have two problems when dealing with pagination and I could do with some clarification.

1. `https://discuss.elastic.co/admin/users/list/all.json?api_key=KEY&api_username=USER&page=0` and `https://discuss.elastic.co/admin/users/list/all.json?api_key=KEY&api_username=USER&page=1` seem to return the same thing.
2. `https://discuss.elastic.co/admin/users/list/all.json?api_key=KEY&api_username=USER&page=9999999` returns a HTTP 200, but no body, because the page count doesn’t go that high.

I don’t seem to see anything in the response body or headers to indicate what the first/next/last page is. And the docs only say it takes an integer (buts accepts negative ones too).

Appreciative of any guidance that can be offered 🙂

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [2018年一月3日 15:28 UTC](https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158/2 "2018-01-03T15:28:00Z")

</div>

The page param starts at 1. If it’s less than 1, it’s assumed to be page 1. ([Code here](https://github.com/discourse/discourse/blob/master/lib/admin_user_index_query.rb#L28-L31).) And you’re right that we don’t return any attribute saying how many pages there are, so I guess the best thing right now is to stop when you find a page with less than 100 results.

---

<div class="post-metadata">

### Author: ![Mark\_Walkom](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_walkom/32/77411_2.png) [@Mark\_Walkom](https://meta.discourse.org/u/Mark_Walkom)
#### Post date: [2018年一月7日 04:39 UTC](https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158/3 "2018-01-07T04:39:29Z")

</div>

Thanks for that response 🙂

---

<div class="post-metadata">

### Author: ![dnsmichi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dnsmichi/32/379505_2.png) [@dnsmichi](https://meta.discourse.org/u/dnsmichi)
#### Post date: [2018年一月7日 13:55 UTC](https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158/4 "2018-01-07T13:55:42Z")

</div>

Just an idea for a possible feature request: Would it be reasonable to implement this the way Github builds pagination? Over there, the returned header gives you feedback about the next fetched page (“links”). Rationale for them is to serve each request on its own, without “page guessing”.

Example client code:

[https://github.com/Icinga/icinga2/blob/master/changelog.py#L65](https://github.com/Icinga/icinga2/blob/master/changelog.py#L65)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年一月8日 01:36 UTC](https://meta.discourse.org/t/clarifications-on-use-of-page-url-parameter/77158/5 "2018-01-08T01:36:18Z")

</div>

Front page `/latest` already does this, totally open to have all pagination APIs follow the same pattern as front page does.
