𝗥𝗙𝗖 𝟭𝟬𝟬𝟬𝟴: 𝗧𝗵𝗲 𝗡𝗲𝘄 𝗛𝗧𝗧𝗣 𝗤𝘂𝗲𝗿𝘆 𝗠𝗲𝘁𝗵𝗼𝗱
Developers face a problem when fetching complex data. You want to use GET, but it has limits. You want to use POST, but it is the wrong tool for the job. RFC 10008 proposes a new solution: the QUERY method.
The current struggle with GET:
- URL limits: Browsers and servers limit URL length. Large filters break your requests.
- Messy structure: GET uses simple key-value pairs. Sending nested JSON objects is difficult.
- Privacy risks: Query parameters show up in server logs and browser history.
The current struggle with POST:
- Wrong semantics: POST tells the server you want to create or change data.
- Caching issues: Most systems do not cache POST requests. This slows down your application.
The QUERY method changes this. It allows you to send a request body for data retrieval. It keeps your API clean and follows proper rules.
Benefits of the QUERY method:
- Use complex bodies: You can send full JSON objects for search filters.
- Stay safe: It does not change server state.
- Improve speed: It allows for efficient caching like the GET method.
Stop forcing POST to do a GET job. The QUERY method provides a way to fetch rich data without breaking HTTP standards.
Source: https://dev.to/kelvin_kariuki_20f4bec616/developer-take-on-rfc-10008-the-new-http-query-method-25fo