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:
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,
Solved! Go to Solution.
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.
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.
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