Introduction
When working with the Symmetry APIs, you may encounter large datasets that are split across multiple pages. Properly handling pagination ensures that you retrieve all relevant data incrementally without missing any entries or overwhelming your system with too much data at once.
Pagination Methods in Symmetry APIs
Symmetry supports both page-based and cursor-based pagination methods, depending on the specific API endpoint. Refer to the API documentation for the exact pagination strategy used in each case.
Page-based Pagination
This method uses numeric parameters such as page and pageSize to specify which page of results to retrieve and how many results per page.
Example parameters:
- page: The page number to retrieve, starting at 1.
- pageSize: The number of records to return per page (e.g., 50, 100).
To fetch all records, increment the page parameter until no more results are returned.
Cursor-based Pagination
Some endpoints may use cursor-based pagination, where the response includes a token that represents the cursor position for the next page of results.
In this method:
- The API response contains a field like nextCursor or nextToken that you use in the subsequent request to fetch the next set of results.
- When the cursor/token is missing or empty, it indicates there are no more results to retrieve.
Best Practices for Pagination
- Always check the API documentation for the specific pagination parameters and methods supported by the endpoint you are working with.
- Implement looping logic in your integration to iteratively request all pages or cursor sets until the entire dataset is retrieved.
- Use reasonable pageSize values to balance between performance and payload size; avoid too large values that may cause timeouts.
- Handle edge cases such as empty pages or unexpected missing tokens gracefully.
- Store retrieved data securely and ensure idempotency in case requests need to be retried.
Example: Using Page-Based Pagination
Below is an example sequence to retrieve paginated data from a Symmetry API endpoint using page-based pagination:
- Set page to 1 and choose a suitable pageSize (e.g., 100).
- Make an API request with these parameters.
- Process the returned data and store it as needed.
- If the response contains the full pageSize number of results, increment page by 1 and repeat from step 2.
- If fewer results are returned, you have reached the last page.
Additional Resources
For detailed technical reference on pagination parameters and example API calls, please consult the Symmetry API documentation at [Insert API documentation URL].
If you encounter issues or need assistance with pagination or other API features, contact Symmetry Support at [Insert support contact details].
Comments
0 comments
Please sign in to leave a comment.