The DayPilot.Http.patch() method makes an HTTP request to the specified URL using the PATCH method.
The syntax and behavior is inspired by axios.
It is a static method.
Declaration
DayPilot.Http.patch(url[, data[, options]]);Parameters
url(string) - URL of the HTTP requestdata- the HTTP request body. If this is an object, it will be converted to JSON usingJSON.stringify(); a string is passed as is.options.contentType(string, optional) - request body content type. The default value is"application/json"ifdatais an object, or"text/plain"for other types.options.headers(object, optional) - an object with header values
Return Value
The DayPilot.Http.patch() method returns a promise. The promise resolves for HTTP status codes 200, 201, 204, and 304 when any nonempty response body is valid JSON. It rejects for other statuses or malformed JSON.
Resolved promise handlers receive an args object with the following properties:
args.request-XMLHttpRequestobject used for making the requestargs.data- event data received from the server, converted from JSON to object usingJSON.parse()
Rejected promise handlers receive an args object with the following property:
args.request-XMLHttpRequestobject used for making the request
Response Parsing
In Pro since version 2026.4.7086, malformed JSON rejects the promise with an object containing args.request and args.exception. Use try/catch or a rejected-promise handler to handle it.
An empty successful response body is accepted and leaves args.data undefined. Unlike collection loaders such as events.load(), this HTTP helper does not require the JSON value to be an array.
Example
const data = {
name: "John"
};
const id = 1;
const {data: result} = await DayPilot.Http.patch(`/user/${id}`, data);
console.log("result", result);See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot