The PATCH request method is used to partially modify a resource on the server. To send a PATCH request to the server, you need to use the HTTP PATCH method and include the request data in the body of the HTTP message. The Content-Type request header must indicate the data type in the body. In this PATCH request example, we send JSON to the ReqBin echo endpoint to update the data on the server.
HTTP is an application layer data transfer protocol that is widely used to transfer data between HTTP clients (browsers, mobile apps, etc.) and servers. HTTP defines a variety of request methods that indicate the desired action (add, update, delete, etc.) for a given resource. While their names can be nouns, these request methods are sometimes referred to as HTTP verbs. Each of them implements its own semantics, but each group of commands has common properties: for example, whether methods are safe or not.
What is the HTTP PATCH request method used for?
The HTTP PATCH request method used to partially modify an existing resource on the server. The PATCH request method may or may not be idempotent, unlike PUT, which is always idempotent. An operation is considered idempotent if sending an identical PATCH request multiple times produces the same result as a single operation, does not affect the further state of the server, and does not cause additional side effects.
How to send data with a PATCH request?
You can send data to the server in the body of an HTTP PATCH message in the same way as for the POST request. The type and size of data are not limited. The Content-Type request header must indicate the correct data type in the body of the PATCH message.
PATCH Request Example
An example of sending a PATCH request to a ReqBin echo API endpoint.