4 Replies Latest reply on Sep 1, 2014 12:55 AM by thomaslambert

    How to handle API pagination by programing

    thomaslambert

      Hello all,

       

      I'm developing a sort of Jive API wrapper for google apps script. I try to be very clean in the programming, and in order to have small function, I like to call my custom fetch function. This function will then handle options, logging for debugging and pagination.

       

      However I'm having some trouble on a specific call.

      When I call something like  https://myinstance.jiveon.com/api/core/v3/people/?ids=20387,2147 a links.next is returned

      https://myinstance.jiveon.com/api/core/v3/people/?sort=firstNameAsc&fields=%40summary&origin=unknown&count=25&startIndex=2

      Even though I only asked for 2 results and I just got those.

       

      How could I know in the context of that function, that no pagination is needed ?


      Thank you

      Thomas

        • Re: How to handle API pagination by programing
          Ryan Rutan

          Thomas, I'll log this as a bug as I was able to reproduce.  Unfortunately, it looks like when specifying the IDs in the manner, that it throws off the logic to show/hide the next link.  The appearance of the "next" navigation is how you know if there are more rows to fetch, and the URL it is providing most certainly is not correct.

           

          Wish I had a better answer for you, but I've gone ahead and filed the issue.

          JIVE-48002 - Invalid API "next" Link for People Service When Using ids Filter