Documentation
Difficulty level:
API - Booking - POST booking/add
POST booking/add
Used for
Adding a booking. The same checks are performed as in the check function. If all checks are ok, the booking is made.
Authentication
Anonymous access is allowed.
Parameters
Parameter | Description | Required | Example |
---|---|---|---|
object_id | Object ID of the booking | Yes* | 1 |
combi_id | Object ID of the booking | Yes* | 2 |
number | Number of places | No | 1 |
fromdate | From date of the booking | Yes | 2012-08-26 |
tilldate | Till date of the booking. If not set equal to fromdate | No | 2012-08-26 |
fromtime | From time of the booking | No | 10:00 |
tilltime | Till time of the booking | No | 12:00 |
customer | Customer object can be supplied If customer_id is supplied, the booking will be attached to that existing customer |
No | |
options | An array of options, each in combination of the option_name and the required number | No | |
participants | An array of participants, each in combination of the participant_name and the required number | No |
* Object_id OR combi_id is needed. One of these should be present in the request.
Example 1
Adding a booking for 4 people on a slot which is already booked.
POST api/rest/booking/check
Request: { "object_id": "1", "fromdate": "2012-08-26", "tilldate": "2012-08-26", "fromtime": "10:15", "tilltime": "10:20", "number": "4" } Response: { "status": false, "messages": [ "The selected period is not available" ] }
Example 2
Adding a booking for 4 people (2 adults and 2 children). Include a new customer and include an option.
POST api/rest/booking/check
Request: {
"object_id": "1",
"fromdate": "2012-08-27",
"tilldate": "2012-08-27",
"fromtime": "10:15",
"tilltime": "10:20",
"number": "4",
"customer": {
"lastname": "Demo"
},
"participants": {
"0": {
"Volwassenen": "2"
},
"1": {
"Kinderen": "2"
}
},
"options": {
"0": {
"taart": "1"
}
}
}
Response: {
"status": true,
"booking_id": 40690,
"messages": [
"Booking made"
]
}
Example 3 - Overflow booking
Adding a booking for 8 people (5 adults and 3 children) where overflow is applicable and participants.
POST api/rest/booking/check
Request: { "object_id": "1", "fromdate": "2012-08-27", "tilldate": "2012-08-27", "fromtime": "10:15", "tilltime": "10:25", "customer": { "lastname": "Demo" }, "participants": { "0": { "Volwassenen": "5" }, "1": { "Kinderen": "3" } } } Response: { "status": true, "booking_id": 40693, "messages": [ "Booking made" ] }