Challenges with Implementing Custom Cursor Pagination for Datadog API


The user is facing challenges implementing custom cursor pagination for a Datadog API. They are struggling to pass the ‘endCursor’ value into their GraphQL query for requesting subsequent pages.


Hello Community,
I am encountering challenges with implementing a custom Page Increment pagination or cursor pagination for a Datadog API and seeking your assistance.
Here’s the challenge:
My Datadog query requires pagination, and I’ve tried using Page Increment pagination with a next token; however, the pagination doesn’t seem to terminate properly.
To address this, I shifted towards custom cursor pagination to leverage the ability to specify a stop condition.

Each page response from the API includes an ‘endCursor’, which I use for fetching the next page of results.
The issue I’m facing:
Although I’m able to extract the ‘endCursor’ value from the first response, I’m struggling to pass this cursor into my GraphQL query to request subsequent pages.
My current setup involves attempting to inject the cursor value into a variable within the JSON payload for the next request. However, despite my efforts,
I can’t seem to correctly pass this cursor value into the query for subsequent requests.
Could anyone provide insights into where my approach might be going wrong? Any suggestions on ensuring the cursor value is used for the next page request?
Thank you in advance for any help you can provide.

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want
to access the original thread.

Join the conversation on Slack

["custom-cursor-pagination", "datadog-api", "graphql-query", "pagination"]