Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total number of job postings #24

Open
achimmer opened this issue Aug 31, 2017 · 5 comments
Open

Total number of job postings #24

achimmer opened this issue Aug 31, 2017 · 5 comments

Comments

@achimmer
Copy link

I'm trying to implement pagination with job postings. How do I get the total number of job postings while using the limit parameter?

@rahuln93
Copy link

Could you figure this out? I am trying to do the same thing.

@rkstedman
Copy link
Contributor

Hello! Thanks for your question. We do not provide the total number of pages or postings. The limit only allows you to set the total per page. If you have 95 published postings and you set the limit to 10, you'll have ten pages of postings:

GET /v0/postings/SITE?limit=10 # page 1
GET /v0/postings/SITE?skip=10&limit=10 # page 2
GET /v0/postings/SITE?skip=20&limit=10 # page 3
...
GET /v0/postings/SITE?skip=90&limit=10 # page 10 (only includes 5 results)

You know you've reached the last page when your request returns fewer results than the provided limit.

Hope this helps!

@achimmer
Copy link
Author

achimmer commented Oct 26, 2017

@rkstedman That works until your last skip of results is the same size as the limit. Which means you have to do an API call only to return no results.

The alternative implies you have to do a separate API call without limit & skip to calculate the number of results, and then factor your pagination that way.

Ideally, the API postings results should return the total if possible. Feature request?

@achimmer
Copy link
Author

achimmer commented Oct 26, 2017

@rahuln93 , I have a working Code Pen with filters and pagination: https://codepen.io/achimmer/pen/XgLoPM

I'm going to refactor my pagination logic (since I don't know the total results using limit & skip) by making a separate API call (3 http requests every time I render job postings). That way I save the user from having to paginate all the way to the end and then serve no results. But this is forthcoming.

@roylindauer
Copy link

Having the total number of records available in the header of the response would be extremely helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants