POST /events
Description
Creates a new event and returns a json object with the event ID in it
The route handles the POST request made to the /events
path.
HTTP method | Route |
---|---|
POST | /events |
Payload
The server needs to receive a json object with the next properties:
Name | Type | Description |
---|---|---|
text | string | Required. The name of a new event to be added. |
start_date | string | Required. The event start date in the ISO format yyyy-MM-dd'T'HH:mm:ss.SSSXXX |
end_date | string | Required. The event end date in the ISO format yyyy-MM-dd'T'HH:mm:ss.SSSXXX |
allDay | boolean | Optional. Enables/disables the event duration throughout the day. |
type | number | Required. The calendar ID which is the event type. |
details | string | Optional. Details about a new event. |
files | object | Optional. An array of the files to be attached to a new event. You can attach files that are already uploaded to the server. The file object should contain the file id, name, and url. |
Example:
{
"text": "New Event",
"start_date": "2021-06-10T03:05:00.369Z",
"end_date": "2021-06-10T10:10:00.369Z",
"allDay": true,
"type": 1,
"details": "Some details",
"files": [
{
"id": 2,
"name": "document.html",
"url": "http://localhost:3000/uploads/2/document.html"
}
]
}
Response
The route returns a json object with the ID of a new event.
Example:
"id": 1
The HTTP status code shows whether the request succeeds (response.status == 200) or fails (response.status == 500).
Related articles: Working with server