Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Pagination through API (Kasper) or JSON
phreak
MVP
Hi all,
When retrieving the categories or discussions ... how does pagination work when retrieving JSON?
We found that if you go direct via the .json then multiple requests for the same URL seems to return subsequent pages. But only if you are logged in.
Is there a a way to determine how many pages there are? Is there a way to get a specific page?
Thanx, phreak
- VanillaAPP | iOS & Android App for Vanilla - White label app for Vanilla Forums OS
- VanillaSkins | Plugins, Themes, Graphics and Custom Development for Vanilla
0
Comments
If a discussion has 3 unread pages, you will be shown the first that contains a comment you have not read. Since it is then marked read, the next request will yield the next page until everything is marked read for the user.
You can request a specific page by appending /p1, /p2 ... to the url
The current page number is contained in the JSON ("Page"), but the total page count is not.
You could calculate it using the "Discussion" -> "CountComments" property from the JSON data.
Or you could add it to the API using a plugin:
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Thanx @Bleistivt! We geared towards the same way and found that this is a quiet untypical way to approach it via sole page requests on the same JSON url.
But thanx we wil do it like you recommended just wondered if there is a smarter way to retrieve the page numbers.