How do I paginate through BTQL project_logs query results?
Last updated: March 25, 2025
Context
When querying project_logs using BTQL, results are automatically paginated with a default limit. To retrieve all results matching your query criteria, you'll need to handle pagination using cursors.
Answer
To retrieve all results from a BTQL project_logs query, follow these steps:
Make your initial query without a cursor:
{ "query": "select: id, created from: project_logs('your-project-id') filter: created > '2025-03-21 22:00:00'" }Check the response for:
The
dataarray containing your resultsA
cursorvalue in the response
If a cursor is present, make subsequent queries by adding the cursor to your query:
{ "query": "select: id, created from: project_logs('your-project-id') filter: created > '2025-03-21 22:00:00' cursor: 'YOUR-CURSOR-VALUE'" }Continue making queries with the new cursor until you receive a response where:
The
dataarray is empty, ANDNo cursor is provided in the response
This indicates you've retrieved all results.
Reference: BTQL Documentation - Limit and Cursor