Skip to main content

New API paging

Paging with the NationBuilder API can be very slow so we improved it and now it is 3x faster (5x in some cases).  Over the past few months I have worked with several developers to move over to the new pagination and now that its tested we are preparing to release it to everyone.  With regards to the new pagination there are three categories that developers and apps fall into.

A) New apps that use the new pagination - For these apps there is nothing that needs to be done.  You will know you fall into this category if you don't see the old next and prev pagination links in your API response.

Note: All apps created after October, 7th, 2014 at 3:00 PM PST fall into this category. 

B) Old apps that use the old pagination and want to upgrade - For this type of user we are adding an checkbox toggle to the apps dashboard on the control panel so that you can upgrade your app to use the new pagination by following the steps below.

     i) Switch to handle the new pagination and use the token_pagination flag
     ii) Uncheck the box for their app and then remove the token_pagination flag from the app

C) Old apps that use the old pagination and do not want to upgrade - You do not have to do anything if you fall into this category but it is best to upgrade so that you can benefit from the improved performance of the new pagination.

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 and you will get back results containing next and prev links that looks like /api/v1/people?__token=foo&__nonce=bar. You can then you can use those links + the access token to access paginations.

Here is a sample implementation in ruby: https://gist.github.com/aq1018/2272cd8953225ee42447 

Please email me at ahardison@nationbuilder.com or ping me on skype at: p01nd3xt3r if you have any concerns or need help switching your app over.

 

Showing 3 reactions

Please check your e-mail for a link to activate your account.