-
Notifications
You must be signed in to change notification settings - Fork 0
events
larsverp edited this page May 25, 2020
·
2 revisions
The events
endpoind is used to list and create events.
- Create a get method, so the events can be shown.
- Create a create method, so new events can be created.
- Create an update method, so events can be changed.
- Create a remove method, so events can be removed.
The get endpoints
do not use any body text.
-
/api/events/preview
returns all event. - For not authenticated users. -
/api/events
returns all events. - Authenticated users only! -
/api/events/[id]
returns event with specificid
.
-
[]
- There are no events to show -
404
- The specific event you're looking for doesn't exist.
200 OK
- returns a JSON object with all/specific event(s).
The post endpoints
require all body data as described.
-
/api/events
returns the data added to the DB.-
title
(required, string, max:191) - The title. -
description
(required, text) - The description. -
host_id
(uuid, exists in host table) - The event host. -
begin_date
(required, timestamp, after or equal to today) - The start date (and time) of the new event. -
end_date
(required, timestamp, after or equal tobegin_date
) - The end date (and time) of the new event. -
thumbnail
(required, url, max:1000) - The url of a image used as a thumbnail.. -
seats
(required, int, min:0) - Total available seats. -
postal_code
(required, string, NL/BE/DE postal code) - Postal code of the location. -
hnum
(required, string, max:191) - House number of the location. -
categories
(required, array, uuids) - Array containing the UUIDs from the categories you wish to add. -
notification
(required, bool) - True if you want to send a mail about the new event. -
rockstar
(required, bool) - True if you want this event to be rockstars only.
-
- Error is only trown when body data is incorrect. Errors are in english like the example below.
{
"message": "The given data was invalid.",
"errors": {
"title": [
"The title has already been taken."
],
"thumbnail": [
"The thumbnail is not a valid URL."
],
"postal_code": [
"This postal code is not recognized. Insert something like: 1234 AB, 4000, 26133 "
]
}
}
201 Created
- returns a JSON object with the created event data.
The put endpoints
do not require anything in the body. Only add the fields you want to change to the body.
-
/api/events/[id]
returns the entire (edited) event.-
title
(string, max:191) - The title. -
description
(text) - The description. -
host_id
(uuid, exists in host table) - The event host. -
begin_date
(timestamp, after or equal to today) - The start date (and time) of the new event. -
end_date
(timestamp, after or equal tobegin_date
) - The end date (and time) of the new event. -
thumbnail
(url, max:191) - The url of a image used as a thumbnail.. -
seats
(int, min:0) - Total available seats. -
postal_code
(string, NL/BE/DE postal code) - Postal code of the location. -
hnum
(string, max:191) - House number of the location. -
notification
(bool) - True if you want to send a mail about the new event.
-
- Errors are equal to the
create endpoint
- No error will be trown when the body is empty
200 OK
- returns a JSON object with the updated event data.
The delete endpoint
does not require anything in the body.
-
/api/events/[id]
removes the event and returns it.
404 Not found
- The requested events does not exist
200 OK
- returns a JSON object with the removed event.