room-booking/README.md

60 lines
1.4 KiB
Markdown

Room Booking
---
This application allows you to create an event in a room booking calendar via a
REST API.
## Setup
If you see this page, the application is already running.
You will have to create users, API keys and calendars
via [admin interface](/admin).
## Usage
A full documentation of the API is available at [`/api/docs/`](/api/docs).
Authentication is done via a Bearer token in the `Authorization` header.
### Create an event
To create an event, you need to send a POST request to `/api/{calendar}/events/`
with the following JSON payload:
```json
{
"name": "Event Title",
"start": "2025-01-02T12:00:00",
"end": "2025-01-02T13:00:00"
}
```
Curl example:
```bash
curl -s \
-H "Authorization: Bearer secrettoken" \
-H "Content-Type: application/json" \
-d "{\"name\": \"Test-Event\", \"start\": \"$(date --iso-8601=minutes)\", \"end\": \"$(date --iso-8601=minutes -d '+2 hours')\"}" \
localhost:8000/api/test-kalender/event
```
The response will contain the event ID:
```json
{"id": "4zx3QAFzoxV3vaZSKGaH2S"}
```
### Delete an event
To delete an event, you need to send a DELETE request to `/api/{calendar}/events/{event_id}`.
Curl example:
```bash
curl -s -X DELETE \
-H "Authorization: Bearer secrettoken" \
-H "Content-Type: application/json" \
localhost:8000/api/test-kalender/event/4zx3QAFzoxV3vaZSKGaH2S
```
The response will be empty but the status code will be `204`.