- Home
- API Design
- What Is The HTTP PATCH Request ...
PATCH Method
The PATCH method is used to apply partial modifications to a resource. The PATCH method is not idempotent, which means that sending an identical PATCH request multiple times can further affect the state of the server or cause additional side effects.
Syntax
PATCH /echo/patch/json HTTP/1.1
Example
The following example demonstrates sending a PATCH request to the server:
Request
PATCH /echo/patch/json HTTP/1.1 Host: www.apitier.com Accept: application/json Content-Type: application/json Content-Length: 100 {PATCH DATA}
Response
202 – Accepted
Indicates that the request has been received but not completed yet. It is typically used in log running requests and batch processing.
202 – No Content
The server has fulfilled the request but does not need to return a response body. The server may return the updated meta information.
200 -OK
Indicates that the request has succeeded.
HTTP/1.1 200 OK Accept: application/json Content-Type: application/json Content-Length: 100 {PATCH DATA}
Specification
Safe | No |
Idempotent | No |
Cacheable | No |
Can have a body | Yes |
Advantages
- Efficient updates
- Consistency
- Partial updates
Disadvantages
The PATCH method can be more complex to implement as compare to PUT method.
The PATCH method is not widely supported by all HTTP servers and clients.