When I run this method locally, I get the pagination information up at the top (page, total_pages, per_page, total); the same result as in NB's API Explorer. When I run it in my production environment... Heroku, nada.
The interesting thing is that the "next" and "prev" hash show up both locally and in production. So, I also tried to use them as markers to loop, making API calls until the "next" hash returns nil, spelling the end of the pagination. Again, this works perfectly fine locally. However, in production this actually made it worse because it resulted in an infinite loop which crashed the app. It seems the API never actually returns next as "nil", but instead keeps returning a unique API URL to the "next" set: "/api/v1/survey_responses?__nonce=[omitted]&__token=[omitted]&page=1448&per_page=100&survey_id=47"
I'm trying to figure if it's NationBuilder's API, my app or Heroku that are causing this discrepancy. Am reaching out to Heroku as well and testing the app itself.
I wanted to see if anyone else has come across this and solved it?
Showing 5 reactions
Sign in with
“We implemented a new (much faster) method of paging results a few months ago but it had been feature flagged so not many people saw it. This is causing the difference in prod vs testing that you are seeing.
The new pagination works like this: /api/v1/people?access_token=xyz&token_paginator=1 you can also add a limit param like this: /api/v1/people?access_token=xyz&token_paginator=1&limit=15 you will get back results containing next and prev links that looks like /api/v1/people?token=foo&nonce=bar then you can use those links + access token to access paginations."
According to NationBuilder, they will be sending out more details on this soon.
Check by cStreet - Mobile event check-in for organizers
Certified Architect
Certified Developer