Online Booking of packages (deprecated)¶
This endpoint is no longer worked on since October 2022. This endpoint may not be available on every Recras instance. It is better to use Book processes or the Book products API
Global Overview (Globaal overzicht)¶
The Online Booking API works closely with the Contact Forms and Packages APIs.
To quickly integrate online booking, you can also use our Javascript-library.
Available Days (Beschikbare Dagen)¶
- POST /api2/onlineboeking/beschikbaredagen¶
With this endpoint, it is possible to check on which days it is possible to book for a specific combination of products.
Example request:
POST /api2/onlineboeking/beschikbaredagen HTTP/1.1 Host: demo.recras.nl Content-Type: application/json { "arrangement_id": 2, "producten": [ // (products) {"arrangementsregel_id": 1, "aantal": 0}, // (package_line_id, quantity) {"arrangementsregel_id": 2, "aantal": 2}, // (package_line_id, quantity) {"arrangementsregel_id": 4, "aantal": 0} // (package_line_id, quantity) ], "begin": "2015-02-01", // (start) "eind": "2015-04-01" // (end) }
- JSON Parameters:
arrangement_id (int) – Required The
id
number of the package (arrangement) to check. Only packages with the propertiesmag_online_geboekt_worden_direct_betalen
(may_be_booked_online_direct_payment) ormag_online_geboekt_worden_achteraf_betalen
(may_be_booked_online_pay_later) are allowed.producten (array) – Required A list of booking lines (boekingsregels) to book, each element is a combination of an
arrangementsregel_id
(package_line_id) and a quantity (aantal).producten[].arrangementsregel_id (int) – Required The
arrangementsregel_id
(package_line_id) from which a booking line will be produced. Thisarrangementsregel_id
must appear in theregels
(lines) of the package specified in thearrangement_id
parameter.producten[].aantal (int) – Required The number of units (eenheden) to book. (aantal means quantity)
begin (date) – An ISO8601 formatted date, the start (begin) of the period to check. Default value: today (vandaag).
eind (date) – An ISO8601 formatted date, the end (eind) of the period to check. Default value: today + 90 days.
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ "2015-02-09", "2015-02-11", "2015-02-12", "2015-02-13", "2015-02-14", "2015-02-15", "2015-02-16", "2015-02-18", "2015-02-19" ]
- statuscode 200:
Input accepted (Invoer geaccepteerd)
- statuscode 406:
Error in input (Fout in de invoer)
- json:
A list of ISO-8601 (more specifically:
YYYY-MM-DD
) formatted dates on which it is possible to book this combination of products.
Available Times (Beschikbare Tijden)¶
- POST /api2/onlineboeking/beschikbaretijden¶
With this endpoint, it is possible to check at which start times (startmomenten) on a specific day it is possible to book for a certain combination of products.
Example request:
POST /api2/onlineboeking/beschikbaretijden HTTP/1.1 Host: demo.recras.nl Content-Type: application/json { "arrangement_id": 2, "producten": [ // (products) {"arrangementsregel_id": 1, "aantal": 0}, // (package_line_id, quantity) {"arrangementsregel_id": 2, "aantal": 2}, // (package_line_id, quantity) {"arrangementsregel_id": 4, "aantal": 0} // (package_line_id, quantity) ], "datum": "2015-02-22" // (date) }
- JSON Parameters:
arrangement_id (int) – Required The
id
number of the package (arrangement) to check. Only packages with the propertiesmag_online_geboekt_worden_direct_betalen
(may_be_booked_online_direct_payment) ormag_online_geboekt_worden_achteraf_betalen
(may_be_booked_online_pay_later) are allowed.producten (array) – Required A list of booking lines (boekingsregels) to book, each element is a combination of an
arrangementsregel_id
(package_line_id) and a quantity (aantal).producten[].arrangementsregel_id (int) – Required The
arrangementsregel_id
(package_line_id) from which a booking line will be produced. Thisarrangementsregel_id
must appear in theregels
(lines) of the package specified in thearrangement_id
parameter.producten[].aantal (int) – Required The number of units (eenheden) to book. (aantal means quantity)
datum (date) – Required An ISO8601 formatted date for which the available start times (startmomenten) are requested. (datum means date)
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ "2015-02-22T11:00:00+01:00", "2015-02-22T11:30:00+01:00", "2015-02-22T12:00:00+01:00", "2015-02-22T12:30:00+01:00", "2015-02-22T13:00:00+01:00" ]
- statuscode 200:
Input correct (Invoer correct)
- statuscode 406:
Error in input (Fout in de invoer)
- json:
A list of ISO8601 formatted times at which it is possible to book.
Check Vouchers (Tegoedbonnen controleren)¶
- POST /api2/onlineboeking/controleervoucher¶
With this endpoint, it is possible to check vouchers (tegoedbonnen) for a specific online booking. A voucher is valid for 1 or more products.
Example request:
POST /api2/onlineboeking/controleervoucher HTTP/1.1 Host: demo.recras.nl Content-Type: application/json { "arrangement_id": 2, "producten": [ // (products) {"arrangementsregel_id": 1, "aantal": 2}, // (package_line_id, quantity) {"arrangementsregel_id": 2, "aantal": 2}, // (package_line_id, quantity) {"arrangementsregel_id": 4, "aantal": 0} // (package_line_id, quantity) ], "datum": "2015-02-22", // (date) "vouchers": ["qwert-asdfg-zxcvb", "ertyu-dfghj-cvbnm", "invalid-code"] }
- JSON Parameters:
arrangement_id (int) – Required The
id
number of the package (arrangement) to check. Only packages with the propertiesmag_online_geboekt_worden_direct_betalen
(may_be_booked_online_direct_payment) ormag_online_geboekt_worden_achteraf_betalen
(may_be_booked_online_pay_later) are allowed.producten (array) – Required A list of booking lines (boekingsregels) to book, each element is a combination of an
arrangementsregel_id
(package_line_id) and a quantity (aantal).producten[].arrangementsregel_id (int) – Required The
arrangementsregel_id
(package_line_id) from which a booking line will be produced. Thisarrangementsregel_id
must appear in theregels
(lines) of the package specified in thearrangement_id
parameter.producten[].aantal (int) – Required The number of units (eenheden) to book. (aantal means quantity)
datum (date) – Required An ISO8601 formatted date for which the available start times (startmomenten) are requested. (datum means date)
vouchers[] (array) – Required a list of strings with vouchers (tegoedbonnen) to be checked.
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "qwert-asdfg-zxcvb": { "valid": true, "processed": [{ "regel_id": 1, // (line_id) "product_id": 4, "prijs_per_stuk": 25, // (price_per_unit) "aantal": 2, // (quantity) }] }, "ertyu-dfghj-cvbnm": { "valid": true, "processed": [{ "regel_id": 2, // (line_id) "product_id": 3, "prijs_per_stuk": 10, // (price_per_unit) "aantal": 1, // (quantity) }] }, "invalid-code": { "valid": false, "reason": "ERR_VOUCHER_INVALID" } }
- statuscode 200:
Input correct (Invoer correct)
- statuscode 406:
Error in input (Fout in de invoer)
- json:
An object of results, with the specified vouchers (tegoedbonnen) as keys and a result per voucher.
Possible reason for rejection (reden van afwijzing):
ERR_VOUCHER_INVALID - code does not exist (code bestaat niet)
ERR_VOUCHER_EXPIRED - voucher has expired (tegoedbon is vervallen)
ERR_VOUCHER_INVALID_PRODUCTS - voucher cannot be used on products booked in this package (tegoedbon is niet te gebruiken op producten die geboekt worden in dit arrangement)
ERR_VOUCHER_USED - voucher has already been used (tegoedbon is al gebruikt)
Check Discount Code (Kortingscode controleren)¶
- GET /api2/onlineboeking/controleerkortingscode¶
Via this endpoint, discount codes (kortingscodes) can be checked for validity.
- Query Parameters:
kortingscode (string) – The code of the discount code (kortingscode)
datum (date) – The ISO8601 date on which the discount code should or should not be valid (datum means date)
arrangement (int) – The ID of the package (arrangement) on which the discount code should or should not be valid
Example of a valid discount code (Voorbeeld van geldige kortingscode)¶
Request:
- GET /api2/onlineboeking/controleerkortingscode¶
GET /api2/onlineboeking/controleerkortingscode?kortingscode=test1234&datum=2019-03-19&arrangement=2 HTTP/1.1 Host: demo.recras.nl Accept: application/json
Response:
HTTP/1.1 200 OK Content-Type: application/json { "naam": "Testcode", // (name: "Test code") "percentage": 25 }
- JSON Parameters:
naam (string) – The name of the discount code (naam means name)
percentage (int) – The discount percentage of the discount code
Example of an invalid discount code (Voorbeeld van ongeldige kortingscode)¶
Request:
GET /api2/onlineboeking/controleerkortingscode?kortingscode=test1234&datum=2015-03-19&arrangement=20 HTTP/1.1 Host: demo.recras.nl Accept: application/jsonResponse:
HTTP/1.1 200 OK Content-Type: application/json false
Reserve Booking (Boeking reserveren)¶
- POST /api2/onlineboeking/reserveer¶
With this endpoint, it is possible to create a booking in Recras.
Example request:
POST /api2/onlineboeking/reserveer HTTP/1.1 Host: demo.recras.nl Content-Type: application/json { "arrangement_id":2, "producten":[ // (products) {"arrangementsregel_id":1,"aantal":0}, // (package_line_id, quantity) {"arrangementsregel_id":2,"aantal":2}, // (package_line_id, quantity) {"arrangementsregel_id":4,"aantal":0} // (package_line_id, quantity) ], "begin":"2015-02-14T14:00:00+01:00", // (start) "betaalmethode": "factuur", // (payment_method: "invoice") "kortingscode": "test1234", // (discount_code) "vouchers": ["qwert-asdfg-zxcvb", "ertyu-dfghj-cvbnm"], "status":"reservering", // (reservation) "stuur_bevestiging_email": true, // (send_confirmation_email) "contactformulier": { // (contact_form) "contact.naam":"Recras", // (contact.name) "contact.afdeling": "API ontwikkeling", // (contact.department: "API development") "contactpersoon.voornaam": null, // (contact_person.first_name) "contactpersoon.achternaam": null, // (contact_person.last_name) "contactpersoon.geslacht": "onbekend", // (contact_person.gender: "unknown") "contactpersoon.email1": "api@recras.nl", "contactpersoon.telefoon1": "050-2112212", // (contact_person.phone1) "contactpersoon.adres":"Kadijk 1", // (contact_person.address) "contactpersoon.postcode":"9747AT", // (contact_person.postal_code) "contactpersoon.plaats":"Groningen", // (contact_person.city) "veel_tekst_0":null // (much_text_0) } }
- JSON Parameters:
arrangement_id (int) – Required The
id
number of the package (arrangement) to check. Only packages with the propertiesmag_online_geboekt_worden_direct_betalen
(may_be_booked_online_direct_payment) ormag_online_geboekt_worden_achteraf_betalen
(may_be_booked_online_pay_later) are allowed.producten (array) – Required A list of booking lines (boekingsregels) to book, each element is a combination of an
arrangementsregel_id
(package_line_id) and a quantity (aantal).producten[].arrangementsregel_id (int) – Required The
arrangementsregel_id
(package_line_id) from which a booking line will be produced. Thisarrangementsregel_id
must appear in theregels
(lines) of the package specified in thearrangement_id
parameter.producten[].aantal (int) – Required The number of units (eenheden) to book. (aantal means quantity)
begin (datetime) – Required An ISO8601 formatted representation of the start time (startmoment) of the booking. (begin means start)
betaalmethode (string) – Required The payment method (betaalmethode) used for this booking. Possibilities:
factuur
(invoice) (for payment afterwards, only possible for packages with the propertymag_online_geboekt_worden_achteraf_betalen
(may_be_booked_online_pay_later)) andmollie
(for direct payment via the payment provider Mollie, only possible for packages with the propertymag_online_geboekt_worden_direct_betalen
(may_be_booked_online_direct_payment)).status (string) – The status of the booking after reservation. Only available for bookings with payment method (betaalmethode)
factuur
(invoice). Default value is taken from the Recras settingonline_boeking_achteraf_betalen_status
(online_booking_pay_later_status).stuur_bevestiging_email (boolean) – Whether a confirmation email (bevestigingsmail) should be sent after reservation. Only available for bookings with payment method (betaalmethode)
factuur
(invoice). Default value istrue
. (stuur_bevestiging_email means send_confirmation_email)kortingscode (string) – An optional discount code (kortingscode). An invalid discount code (non-existent, or not valid on the chosen date) counts as invalid input (see below).
vouchers[] (array) – An optional list of strings with vouchers (tegoedbonnen) to be processed on this booking. An invalid voucher counts as invalid input. It is therefore advisable to check a voucher first.
contactformulier (object) – Required Completed contact form (contactformulier) belonging to this package. For more information, see the documentation for _ContactformulierenSubmit<Contactformulieren opslaan> (Save Contact Forms) and _arrangementen<Arrangementen> (Packages).
mollie_params (object) – Extra parameters to pass to the Mollie Create Payment API. Only possible for payment method (betaalmethode)
mollie
. The parametersamount
andredirectUrl
are not allowed here.redirect_url (URL) –
A URL to which the customer is redirected after payment, regardless of the payment status. It is therefore up to the server to which
redirect_url
refers to check the status of the booking. Only possible for payment method (betaalmethode)mollie
.Example response:
HTTP/1.1 200 OK Content-Type: application/json { "status":"reservering", "message":"Boeking gemaakt", // (message: "Booking created") "boeking_id":42, // (booking_id) "klant_id":63 // (customer_id) }
status – The status of the created booking. This can be a Booking Status or
betaling benodigd
(payment required).message (string) – A message describing the status.
boeking_id (int) – The
id
number of the created booking. Only available for users with theeditBoeking
(editBooking) permission. (boeking_id means booking_id)klant_id (int) – The
id
number of the created or matched customer (klant). Only available for users with theeditBoeking
(editBooking) permission. (klant_id means customer_id)payment_url (uri) – The URL to follow to meet the payment obligation (betalingsplicht). (Only present if
status
is equal tobetaling benodigd
(payment required))
- Status Codes:
200 OK – Booking created (Boeking gemaakt)
403 Forbidden – User has insufficient permissions (Gebruiker heeft onvoldoende rechten)
406 Not Acceptable – Error in input (Fout in de invoer). This can indicate, among other things, a booking made too far/too short in advance (
onlineboeking_maximaal_vooruit
(online_booking_maximum_in_advance) andonlineboeking_minimaal_vooruit
(online_booking_minimum_in_advance) of a package), an invalid start time (startmoment), an invalid (incorrectly filled out) contact form, an invalid payment method, or an overbooking on material and/or location.
Please note: Bookings with a net price of EUR 0.00¶
In the special case of a request to /api2/onlineboeking/reserveer
with payment method mollie
yielding a booking with a net price of EUR 0.00 or lower
(this can happen by the application of vouchers and/or the booking having products with a negative sale price), the redirection to the payment service provider will be omitted.
The status
field of the returned JSON object will then have the booking status definitief
(confirmed) and the payment_url
field will be absent.
This means the customer may be presented with a message confirming the successful creation of the booking.
Recras will follow the same procedure as when in the regular case the ‘payment successful’ notification is received, i.e. booking proposal and invoice will be sent to the customer.