Updating parts of a resource on the server

PATCH Method

Preliminaries

This note provides supplementary information about the server's implementation of the standard HTTP PATCH method, used to replace portions of a resource.

The PATCH method is used by interactive AJAX calls to request the server to update portions of an existing resource.

A software developer must write a custom module with a handler to carry out the request (presumably via some type of server database), and the webmaster must configure a dynamic route with *methods=PATCH which references that module.

Request/response handlers

The server's request/response cycle for PATCH requests is fulfilled using this sequence of handlers:

Request Handler Optional Configurable
1 Server Name Indication no no
2 Hosts no yes
3 IP Access yes yes
4 Resource Masks yes yes
5 Raw Path no no
6 Cookies no no
7 Forbidden yes yes
8 Cross Origin yes yes
9 RBAC yes yes
10 Content Decoding (Patch) no no
Dynamic Handler Optional Configurable
11 Router yes yes
Response Handler Optional Configurable
12 Content Length no no
13 Status Codes no yes

Status codes

Successful responses are finalized by the dynamic module with any of these status codes:

  • 200 "OK" when the response contains a payload and these response headers: content-type, content-length and optionally content-encoding.
  • 204 "No Content" when the response has no payload.
  • 303 "See Other" when the processing is successful and the browser should issue a follow-on GET request to the URI declared in the response's location header.
  • 307 "Temporary Redirect" when the processing is successful and the browser should issue a follow-on PATCH request to the URI declared in the response's location header.

For reference purposes, refer to IETF RFC 5789 PATCH Method for HTTP for the basic protocol expected of PATCH requests.

Updating parts of a resource on the server