DEV Community

Cover image for The new HTTP method : QUERY

The new HTTP method : QUERY

Tykok on June 28, 2026

You work with REST APIs? You know GET, POST, PUT, DELETE... But did you know that a new HTTP method was standardized in June 2026? It's called QU...
Collapse
 
ravavyr profile image
Ravavyr

ok, i don't see the reasoning for it.

  • character limits are large, you should be able to comfortable make GET requests all day with no issue.
  • POSTs creating duplicate entries is just bad code handling, if you use a nonce that problem goes away.

We also have PUT and DELETE that no one ever uses since you can pretty much accomplish all of them with POST just the same.

It just feels like one more thing only some devs will use, and newbies will get confused by and in the end we'll just be doing GET and POST anyway.

Just my 2 cents.

Collapse
 
mathmul profile image
Matej • Edited

You can do everything with POST alone. You can retrieve data, create new entities, update stuff or delete them. Hence I suggest we remove all HTTP verbs including POST, since it can be implied. Problem solved.

On the other hand we may want some semantics, so things clearly show their intent from afar without having to delve into codebase or descriptions. That's why any of my OAS, have very few POST requests, one for every entity that allows the client creation. Then I also seldom use PUT, because there are rare cases, where I intend to update an entity by replacing it whole. I used to create a lot of update forms where you'd change as many values as wanted in GUI and then explicitly PUT them by pressing the Save button. Nowadays, I auto-save most inputs on blur (the opposite of focus), so updates are way more surgical. Hence most of my updates use PATCH request to update existing entity's properties or whatever state is in question. DELETE is self explanatory in all its glory. Admittedly I have never gotten around to try to deeply understand the use cases for HEAD, CONNECT, OPTIONS and TRACE for me, so all that's left is GET. I love using it without query params, but when those are needed, I always disliked how GET is the odd one out of all the HTTP verbs. That is all to say, I am thrilled for QUERY to have become a new standard for this usecase.

As for you, it's simple... Just don't use it.

Edit: I by no means mean that QUERY should replace GET+queryParams everywhere. While it will do so in my OASs, I think it is absolutely essential to keep it, so we can for example share links with already filtered or ordered results.

Collapse
 
ravavyr profile image
Ravavyr

it's a good response, and personally i won't use it, i'll continue logging what my POST requests do and returning errors when the server fails and error messages when the request cannot be fullfilled.

Collapse
 
shyamanand profile image
Shyam Anand

The analogy I've always used for this kind of reasoning is that, yes, you can drive on the wrong side of the road – doesn't mean you should.

"POSTs creating duplicate entries is just bad code handling", is like saying wrong-side driving causing accidents is just poor driving skills.

You may want to read: developer.mozilla.org/en-US/docs/W...

Collapse
 
ravavyr profile image
Ravavyr

lol... what do you call "wrong-side driving accidents" ?
Like, someone makes a choice to do the wrong thing.
Yes, allowing duplicates to happen is bad code handling, it's human error.

On that same note, in the future you'll equate wrong-side driving with "they used POST instead of Query"... which is no different than me saying "they should block duplication in their POSTs" ...which again brings me to Query not being necessary.

Collapse
 
tykok profile image
Tykok

Thanks for sharing your thoughts!

I actually agree with a few of your points. For the vast majority of APIs, GET and POST are enough, and I don't expect QUERY to suddenly become the default method everyone uses.

The motivation behind QUERY isn't really about URL length limits. It's more about HTTP semantics. Sometimes you need to perform a read-only operation, but the query payload is too complex or structured to fit naturally in a query string. Today, many APIs solve this by using POST, but that comes with trade-offs: the request no longer clearly expresses that it's safe and idempotent, which can affect caching, intermediaries, tooling, or simply make the API less self-descriptive.

Regarding duplicate POST requests, I completely agree that good API design (nonces, idempotency keys, etc.) solves that issue. My point wasn't that QUERY replaces those mechanisms, but that it allows read operations to remain read operations instead of overloading POST for everything.

Whether QUERY sees widespread adoption is another question. It may end up being a niche method, just like PATCH took years to become common. But I still think it's an interesting addition because it fills a gap in the HTTP method semantics rather than introducing a completely new capability.

Thanks again for the feedback.

Collapse
 
marudhu_pandiyan_675e84f9 profile image
Marudhu Pandiyan

tks for dropping.

Collapse
 
tykok profile image
Tykok

Thanks for your comment !

Collapse
 
sriram_95722c4cc4c32b9fc4 profile image
sriram

POST /query
very big query

GET /query/query_id_i_just_created

(or)

QUERY /query
very big query

which would be cache friendly, i think the former.🤷

Collapse
 
tykok profile image
Tykok

Good question, thank you for your comments.

But the spec actually lands on the opposite conclusion: QUERY is the more cache-friendly of the two.

RFC 10008 says it directly: "The response to a QUERY method is cacheable; a cache MAY use it to satisfy subsequent QUERY requests." The one twist is that the cache key must incorporate the request body, not just the URI but that's the cache/proxy's job, not something your API has to build.

The POST + GET pattern does work, but it's not "more" cacheable — it's less cacheable out of the box, and it costs you:

  1. Two round-trips (create the query, then fetch by id).
  2. Server-side state you persist the query, mint a query_id, and manage its lifecycle.

And what you cache there is the frozen result behind that id, not the query itself.

That's exactly the Content-Location (URI of the result) vs Location (URI of the query). QUERY gives you both for free: the server can return a Location so you can replay the same query later with a plain GET no body resend and it re-runs against fresh data. POST + GET only gets you the frozen-result URI, and only if you build the storage for it.

So POST caches a static snapshot at the price of extra state and an extra round-trip. QUERY makes the read operation itself safe, idempotent, and cacheable which is the whole gap it was standardized to fill.

Collapse
 
octave_nkurunziza_afb0512 profile image
octave Nkurunziza

Thank you mhn i needed the info

Collapse
 
tykok profile image
Tykok

It's a pleasure, thanks for your comment !

Collapse
 
arjun_singh_462013f37b291 profile image
Arjun singh

Must Read Article

Collapse
 
tykok profile image
Tykok

Thanks for your comment !