Table booking¶
Request Summary
URL: https://personalkollen.se/api/v1/table-booking/
Method: POST
Authentication: HTTP Authorization header with authentication secret
Content-Type: application/json
Introduction¶
This API is used to update table booking information in Personalkollen.
Use the API by posting a list of bookings and the time period that should be updated. The API first clears the period of current bookings and then add the new ones.
Data structure¶
This section describes the data that should be passed to the table booking API. Below is an example of how the request could look like with headers and body provided.
Request Example¶
The API only accept POST requests with the content type JSON.
Headers¶
POST https://personalkollen.se/api/v1/table-booking/ HTTP/1.1
Authorization: Token {secret_token}
Content-Type: application/json
Body¶
{
"period": {
"start": "2022-04-06T17:00:00Z",
"end": "2022-04-19T17:00:00Z"
},
"bookings": [
{
"guests": 5,
"date_and_start_hour": "2022-04-06T17:00:00Z"
},
{
"guests": 10,
"date_and_start_hour": "2022-04-10T18:00:00Z"
},
{
"guests": 22,
"date_and_start_hour": "2022-04-16T17:00:00Z"
}
]
}
Body parameters & data types¶
| Required | Field name | Data type | Description |
|---|---|---|---|
| Yes | period | Period | The affected time period that will be updated. |
| Yes | bookings | Bookings | The list of booking objects. Required but can be left empty. |
Period¶
| Required | Field name | Data type | Description |
|---|---|---|---|
| Yes | start | DateTime | start date time |
| Yes | end | DateTime | end date time |
Bookings¶
Zero or more objects with the following fields.
| Required | Field name | Data type | Description |
|---|---|---|---|
| Yes | guests | Integer | Number of new guests for the hour |
| Yes | date_and_start_hour | DateTime | Timestamp Start time. Must have whole hours |
Warning
All table bookings must be within the given time period and have an unique date_and_start_hour
DateTime¶
Represented as an ISO 8601 string in UTC.
Info
Every DateTime field in this API must be sent in whole hours e.g 2022-04-16T17:00:00Z
Integer¶
Represents an integer with no decimals allowed.
HTTP requests and responses¶
204 NO CONTENT¶
The request was successfully processed. No content is returned.
401 PERMISSION DENIED¶
400 BAD REQUEST¶
Invalid format, data types, or data values not passing the validation rules.
Bad Request Examples¶
Period end is before start
Time not in whole hours
Booking outside time period
Bookings with the same date and start hour
405 Method not allowed¶
Response code 405 indicates either the request method is wrong or something has caused the request to redirect and then getting the wrong request method.
Make sure that the request method is POST, and that the url has https not http and that it has a trailing slash.
https://personalkollen.se/api/v1/table-booking/