I built a transport-independent foundation for JSON API clients in Perl
Description and use
HTTP::API::Core enables transport‑independent JSON API clients in Perl by separating HTTP transport from policy logic, handling retries, pagination, rate limits, and authentication in a reusable way.
Problem
API clients quickly grow from simple wrappers to complex infrastructure code handling retries, pagination, rate limits, authentication, etc.
Outcome
Clients can focus on API logic while HTTP::API::Core handles retries, pagination, rate limits, and authentication in a transport-agnostic way, reducing code duplication and improving maintainability.
Workflow
- 1. Choose an HTTP transport (e.g., HTTP::Tiny).
- 2. Instantiate HTTP::API::Core with base_url, headers, timeout, and retry config.
- 3. Call API methods (get, post, etc.) via the core instance.
- 4. Use core’s json() to decode responses.
- 5. For pagination, use paginate() with mode (cursor/page) and mapping options.
- 6. Handle rate limits via response->rate_limit().
- 7. Implement authentication by providing a hook or headers.
- 8. Keep service-specific client code minimal, delegating infrastructure to the core.
Evidence
HTTP::API::Core sits above the transport layer.
Retries are more complicated than they look
- Record date: 2026-09-22T02:30:21.275Z