HTTP/2 improves API efficiency without changing familiar HTTP requests, responses, methods, or status codes. It compresses headers and bodies, uses binary transmission, and supports persistent connections with parallel requests. section 13.2.1
Choose HTTP/2 when connection efficiency affects consumer experience:
- Prefer it over HTTP/1.1 when consumers need parallel requests without opening multiple connections. section 13.2.1
- Use a well-designed REST API over HTTP/2 when GraphQL-specific aggregation or selection features are unnecessary. section 14.8.1
- Consider gRPC for internal microservices needing HTTP/2 bidirectional streaming, but not when browsers must consume the API. section 14.8.1
Parallel API loading
A consumer loading several JSON resources can send requests in parallel over one persistent HTTP/2 connection. HTTP/1.1 instead requires multiple connections for parallelism, while compression reduces transferred textual data. section 13.2.1
