Tech

RFC 10008 introduces HTTP QUERY method to resolve REST API limitations

The Internet Engineering Task Force has published a new HTTP method designed to handle advanced relational queries without the semantic or technical baggage of GET and POST workarounds.

Author
Owen Mercer
Markets and Finance Editor
Published
Draft
Source: Hacker News · original
Tech
No image available
New standard aims to fix complex data retrieval issues in web infrastructure

The Internet Engineering Task Force has published RFC 10008, defining a new HTTP method known as QUERY. This development addresses longstanding limitations in RESTful API design, specifically regarding complex data retrieval. Traditional reliance on GET requests for filtering often results in excessively long URLs that exceed character limits imposed by browsers, servers, and proxies. Conversely, using POST for read-only operations introduces semantic inconsistencies, as POST is non-idempotent and intended for resource creation, which complicates caching and automatic retries.

The QUERY method is defined as safe and idempotent, similar to GET, but uniquely permits a request body. This allows for advanced relational queries and deep nesting without the proxy handling issues or caching ambiguities associated with previous workarounds, such as GET requests with JSON bodies. The method aims to resolve issues with URL character limits, inconsistent proxy handling, and caching limitations when using GET with bodies or POST for reads.

Traditional RESTful APIs rely on GET for fetching data, POST for creation, and PUT for updates. Complex filtering using GET often involves query parameters, which can lead to massive URLs that hit browser or server character limits. Using GET with a JSON request body is theoretically possible but practically problematic, as various clients, proxies, and web servers handle it differently. Some reject it, some drop the body, and others interpret it, creating compatibility issues for users behind corporate firewalls or using different browsers.

Using POST for read-only queries introduces semantic issues, as POST is non-idempotent and intended for resource creation, complicating automatic retries and caching. Existing infrastructure, including browsers, standard HTTP forms, proxies, and firewalls, primarily support only GET and POST methods. The QUERY method is defined as safe and idempotent, similar to GET, but allows for a request body. It aims to resolve issues with character limits, proxy handling, and caching associated with previous workarounds.

The QUERY method is defined as safe and idempotent, similar to GET, but permits a request body. It allows for caching, provided the implementation incorporates the request content into the cache key. The method aims to resolve issues with URL character limits, inconsistent proxy handling, and caching limitations associated with previous workarounds like GET with a body or POST for read-only operations.

While the QUERY method offers a fitting solution for complicated search queries, adoption timelines across all web infrastructure are unspecified. Developers are advised to consider and test the method where standard GET requests do not suffice, keeping in mind that full support may take time to materialise across the broader web ecosystem.

Continue reading

More from Tech

Read next: France Enacts Strict Ban on Unsolicited Telemarketing Calls
Read next: OpenAI expands Daybreak cybersecurity programme with new model tiers
Read next: AI models map 766 genes in schizophrenia genetic architecture