HTTP Methods

The verb on an HTTP request: GET reads, POST creates or submits, PUT replaces, PATCH edits, and DELETE removes.

which request type should I useGET vs POSTthe GET or POST word before the linkhow do I update without replacing everythinghttp methdoswhat is the difference between PUT and PATCHthe docs say POST here but I do not know whywhy is my form sending a GET

See it

Live demo coming soon

What it is

An HTTP method is the verb at the front of a request. GET reads, POST submits or creates, PUT replaces a resource, PATCH changes part of one, and DELETE removes it. Those meanings are part of HTTP's contract, not decoration: browsers, caches, proxies, and API clients use the method to decide how a request may be handled.

Choose the method by the operation's semantics. GET should be safe and make no requested state change. PUT and DELETE are idempotent, meaning repeating the same request should leave the server in the same final state. POST is the usual choice when each repeat could create another result. PATCH is for partial updates, but a PATCH operation is not automatically idempotent. One quirk worth knowing: an HTML form can only send GET or POST, which is why Rails and Laravel fake PUT and DELETE with a hidden _method field.

The gotcha is treating every endpoint as POST because it carries JSON. That hides useful guarantees and breaks ordinary HTTP behavior such as GET caching. Follow RFC 9110 semantics, do not use GET for side effects, and add an idempotency key when a retryable POST could charge, book, or create twice.

Ask AI for it

Design these routes using the HTTP method semantics in RFC 9110. Use GET only for reads, POST for creation, PUT for full replacement, PATCH for validated partial updates, and DELETE for removal. Make PUT and DELETE idempotent, return 405 Method Not Allowed with an Allow header for unsupported methods, and require an Idempotency-Key header on POST operations that could create duplicate charges or records.

You might have meant

rest apiendpointhttp status codesidempotency keyrequest headers