The DayPilot.Http.put() method makes an HTTP request to the specified URL using PUT method.
The syntax and behavior is inspired by axios.
Declaration
DayPilot.Http.put(url[, data[, options]])Parameters
data- the HTTP request body; if this is an object, it will be converted to JSON usingJSON.stringify(); string is passed as isoptions.contentType- request body content type (string). Default value is"application/json"(ifdatais an object) or"text/plain"for other types.options.headers- an object with header values
Return Value
The DayPilot.Http.put() method returns a promise. If the HTTP response status code is 200, 201, 204 or 304 the promise is resolved, otherwise it is rejected.
The success handler receives an args object as an argument:
args.request- XMLHttpRequest object used for making the requestargs.data- event data received from the server, converted from JSON to object usingJSON.parse()
The error handler receives an args object as an argument:
args.request- XMLHttpRequest object 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.put(`/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