When working with remote or web APIs (e.g. REST APIs), there can be multiple challenges like:
- Throttling and error recovery:
If sending too many automatic requests, you may either exceed your granted quota or even overwhelm the API server, producing an error in both cases. You can handle this by catching the error, waiting a certain amount of time and retrying the request, of course still failing after too many attempts or a certain timeout.
When requesting multiple items, the API may only allow a limited page size. I.e., you must send multiple requests using an incrementing page size and then combine the results into the full list of items.
- Timespan restrictions:
Similar to paging, the API may only allow to request items of a limited time span (e.g., created within a span of three months). I.e., you must create multiple time spans and combine the results into the full list of items.
Usually, these issues are not addressed by wrapper libraries that may be available for a programming language/platform.
So far, I have written code to solve these issues by myself, but since they are ubiquitous, I was wondering whether there are libraries to help you with these issues, preferably for the Java Virtual Machine (ideally, specifically for the Kotlin language).