Skip to main content
Solved

How to use pagination in the API (for users)

  • November 6, 2024
  • 4 replies
  • 177 views

Forum|alt.badge.img+1

Hi!

I’m using this API

https://miprepschool.incidentiq.com/api/v1.0/users

following the documentation in

https://incidentiq.stoplight.io/docs/v1/cf6fa0da7eb82-list-users

 

but I’m getting just the first 20 items.

Could you someone let me know how to access the next page?

 

I’m doing something like below (python):

 

params = {

    'PageIndex': 2,

    'PageSize': 20

}

try:

    response = requests.get(url, headers=headers, params=params)

 

or trying different variations in the params or directly in the url, but not having any luck.

 

Thank you!

 

 

 

 

 

 

Best answer by jclark

Your paging parameters will be part of your endpoint.
.../api/v1.0/users?$p=0&$s=20

Where ‘p’ is the Page Index (starts at 0 for the first page, goes up from there) and ‘s’ is the number of results per page you want.

4 replies

Forum|alt.badge.img+16
  • Specialist
  • Answer
  • November 6, 2024

Your paging parameters will be part of your endpoint.
.../api/v1.0/users?$p=0&$s=20

Where ‘p’ is the Page Index (starts at 0 for the first page, goes up from there) and ‘s’ is the number of results per page you want.


Forum|alt.badge.img+1

@jclark This worked! Thank you so much!!


Kathryn Carter
Forum|alt.badge.img+18
  • Community Manager
  • November 6, 2024

@PSon 843ede9 miprepschool Thank you for submitting your question to our community! 😄 I am so glad we could get you the answer you needed! (from one of our API Masters himself)

@jclark do you have a special alert for when API questions come into the Community? I love your initiative and dedication to this. 😄


Forum|alt.badge.img+16
  • Specialist
  • November 6, 2024

@PSon 843ede9 miprepschool Thank you for submitting your question to our community! 😄 I am so glad we could get you the answer you needed! (from one of our API Masters himself)

@jclark do you have a special alert for when API questions come into the Community? I love your initiative and dedication to this. 😄

Lol @Kathryn Carter Not even close to being a master! I’m just fortunate enough that I get to learn new skills on my own to make things work as the needs arise, and share what I find with those in the same boat. I am subscribed to a few areas of the community because I like seeing new ideas! If a question comes through and I feel like I can answer it, I try to.