Cursor pagination not working as expected in Data Stream
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi everyone,
I’m working on a Data Stream Action in ServiceNow to integrate with an external API that uses cursor-based pagination.
The API response looks like this:
I have configured Pagination setup:
For the REST step, I am passing:
Getting the below 400 error:
{"type":"about:blank","title":"Bad Request","status":400,"detail":"{\"errorId\":\"e7ab5292-10dd-49e3-8711-2252e8651be7\",\"error\":\"malformed_cursor\"}","instance":"/api/v1/users"}
If anyone faced this issue earlier, please help me.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @snehakarthi ,
Can you Try the below script and try to verify in the logs that next cursor is coming properly.
(function paginate(variables, pageResponse) {
var hasMore = pageResponse.paging.has_more;
var nextCursor = pageResponse.paging.next_cursor;
if (hasMore && nextCursor) {
variables.getNextPage = true;
variables.next_cursor = nextCursor;
} else {
variables.getNextPage = false;
variables.next_cursor = null;
}
gs.info("Next Cursor: " + variables.next_cursor);
})(variables, pageResponse);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @tejarekanda,
I'm still getting the below error:
{"type":"about:blank","title":"Bad Request","status":400,"detail":"{\"error\":\"malformed_cursor\",\"errorId\":\"4437a4b0-8d48-4a5f-bf2e-d455e6002a6b\"}","instance":"/api/v1/users"}
Thanks!
