Pagination issues with some endpoints | Community
Skip to main content
December 15, 2017
Solved

Pagination issues with some endpoints

  • December 15, 2017
  • 1 reply
  • 3572 views

We are having issues with the pagination using some endpoints, regarding the documentation the API should return the property “moreResult” which indicates if there are more results in subsequent pages.

In these endpoints the “moreResult” property is not coming:

  • /rest/v1/lists.json
  • /rest/v1/lists/{LIST_ID}/leads.json
  • /rest/v1/leads/programs/{PROGRAM_ID}.json
  • /rest/v1/campaigns.json

Request:

/rest/v1/lists.json?batchSize=5&access_token=xxxxxxxxxxxxxx

Response:

{

    "requestId": "f9fc#1605b4c5a14",

    "result": [

        {

            "id": 1001,

            "name": "Tradeshow1",

            "workspaceName": "Default",

            "createdAt": "2015-11-15T20:03:16Z",

            "updatedAt": "2016-12-28T20:17:17Z"

        },

        ........

        ........

        ........

     ],

    "success": true,

    "nextPageToken": "TMXXXAWSCCSRDRWQZ33VCJOFXI======"

}

I think the "nextPAgeToken" property is not reliable to determine if are more results.

Any idea? What can we do?

Thanks in advance,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by everly

The endpoints that you mention do not return a "moreResult" property.  Rather, they return "nextPageToken" in the case where the result set exceeds the batchSize (which defaults to 300).  To retrieve the entire result set, repeatedly call the endpoint and update nextPageToken with the value that was returned in previous request.  Repeat this until nextPageToken is no longer returned. 

If you have a reproducible case where this process is unreliable, please file a case with Marketo Support.  Sorry for the confusion, we'll get the documentation updated.

1 reply

everlyAccepted solution
Employee
December 18, 2017

The endpoints that you mention do not return a "moreResult" property.  Rather, they return "nextPageToken" in the case where the result set exceeds the batchSize (which defaults to 300).  To retrieve the entire result set, repeatedly call the endpoint and update nextPageToken with the value that was returned in previous request.  Repeat this until nextPageToken is no longer returned. 

If you have a reproducible case where this process is unreliable, please file a case with Marketo Support.  Sorry for the confusion, we'll get the documentation updated.

April 24, 2018

Hi,

This just bit me as well. It does not look like the docs were ever updated. The Position-Based section of http://developers.marketo.com/rest-api/paging-tokens/​ still says:

When there are more results, the moreResult field is true in the response, and a nextPageToken is returned.

Why not always set "moreResult" for consistency sake?

Thanks,

Ian