Limit vs Next Link: Which Pagination Strategy to Use for Harvester API
0 reputation · 02 Nov 2024, 09:46 UTC
Goal
Determine the most reliable method for retrieving large VM or volume lists from the Harvester REST API while handling edge cases such as an empty result set.
Constraints & Uncertainty
The API documents both a limit query parameter and an optional next link in responses. The default value for limit is stated as 100, but the exact number is not explicitly listed in the spec, and the presence of a next link is not guaranteed in all versions. Additionally, the behavior when limit is set to 0 or a negative value is undocumented; some releases return an empty list, others return an error.
Specific Questions
- What is the documented default limit for Harvester list endpoints, and how should clients handle it when omitted?
- How should a client interpret a
limit=0request—should it return an empty list or an error response? - Under which conditions is a
nextlink guaranteed to appear in the response?