Overview
Many Falcon API endpoints return paginated results to handle large datasets efficiently. PSFalcon provides automatic pagination support through the-All parameter, allowing you to retrieve complete result sets without manual page handling.
How Pagination Works
From/home/daytona/workspace/source/private/Private.ps1:619-661, PSFalcon’s Invoke-Loop function handles pagination automatically:
1
Initial Request
PSFalcon makes the first API request with your specified parameters.
2
Response Analysis
The response includes pagination metadata:
total- Total number of results availableoffsetorafterornext_token- Token for next page- Current count of retrieved results
3
Automatic Iteration
If
-All is specified and more results exist, PSFalcon:- Calculates the next offset/token
- Makes subsequent requests automatically
- Outputs results as they’re received
- Continues until all results are retrieved
Using the -All Parameter
The simplest way to retrieve all results:Pagination Parameters
PSFalcon commands support various pagination parameters:-Limit
-Limit
Maximum number of results per request.When used with
-All, sets the page size for each request.-Offset
-Offset
Position to begin retrieving results (zero-based).
-All
-All
Automatically retrieve all available results.
-Total
-Total
Return only the total count, not the results.
Automatic Limit Optimization
From/home/daytona/workspace/source/private/Private.ps1:732-737, when using -All without -Limit:
Pagination Token Types
From/home/daytona/workspace/source/private/Private.ps1:621-630, PSFalcon supports multiple pagination methods:
Pagination Token Types
Pagination Token Types
Progress Tracking
From/home/daytona/workspace/source/private/Private.ps1:655, PSFalcon logs progress to the verbose stream:
Response Metadata
Every paginated response includes metadata:The
-RawOutput parameter is available on many commands to return the complete API response including metadata.Endpoint-Specific Limits
From/home/daytona/workspace/source/public/devices.ps1:205-216, different endpoints have different maximum limits:
-Limit value if it exceeds the maximum.
Manual Pagination
For advanced scenarios, you can manually control pagination:Performance Considerations
1
Use Maximum Limit
Set
-Limit to the maximum allowed for the endpoint to minimize API calls:2
Filter Early
Apply filters to reduce the result set size:
3
Process Incrementally
For very large result sets, process batches instead of loading everything into memory:
Token Refresh During Pagination
From/home/daytona/workspace/source/private/Private.ps1:635-638, PSFalcon automatically refreshes authentication tokens during long pagination operations:
Handling Pagination Errors
From/home/daytona/workspace/source/private/Private.ps1:658-660:
Common Patterns
Scroll Endpoints
Some endpoints use scroll-based pagination with theafter token:
/home/daytona/workspace/source/private/Private.ps1:622-624, the after token is automatically detected and used.
Best Practices
1
Use -All for Complete Datasets
Let PSFalcon handle pagination automatically:
2
Set Appropriate Limits
Use maximum limits with
-All for better performance:3
Check Totals First for Planning
Use
-Total to understand dataset size:4
Handle Interruptions
Implement error handling for large operations:
5
Monitor Progress with -Verbose
Track long-running operations:
Related Commands
Most PSFalconGet-* commands support pagination:
Get-FalconHost- Retrieve hosts with paginationGet-FalconDetect- Retrieve detections with paginationGet-FalconIncident- Retrieve incidents with paginationGet-FalconAlert- Retrieve alerts with pagination
Next Steps
Filtering
Learn FQL syntax to reduce result sets before pagination
Authentication
Understand token management during long operations