Skip to main content

Reserve a random appointment among the first 10 available appointments with one or more services for the given arguments

POST 

/api/v2/branches/:branchPublicId/reserveRandomAvailable

Reserve a random appointment among the first 10 available appointments with one or more services for the given arguments.

If a confirmation of the reserved appointment is not sent within the defined reservation expire timeout (default 10 minutes) the appointment is discarded and the timeslot for the selected resource becomes available again.

Optionally, one can supply an extra matrix parameter: ;numberOfCustomers=N where N is the total number of customers on the appointment. This is used when calculating the total required timeslot length for the appointment. If omitted, it defaults to 1. If set to 0, it uses 1 customer.

If the setting to enable custom slot length is enabled in the calendar configuration, it is possible to override the calculated appointment duration (which is normally based on service time and no of customers). To do this add a matrix parameter "customSlotLength" to the request, which specifies the booking time in minutes. Simply add e.g. ";customSlotLength=60" to the URL in the example above. The REST endpoint will throw an error if an attempt is made to use customSlotLength without the setting being enabled.

HTTP status 404 will be returned if reservation cannot be performed due to that an available slot cannot be found.

curl -i -X POST -H "Content-Type: application/json" -d '{
"services": [
{"publicId":"4c2fe2853f1f4b429b928faabc8b35e6c6a3154ff883163f4149676e4a84df00"},
{"publicId":"df20bd853e13c5b71715f3f332ec304839637ac8b34cdd3c20c9820f01377dd9"}
]}'
"http://localhost:8080/calendar-backend/public/api/v2/branches/6f27497fb5cc458ff05242ebb3a11872cd17e501eff275074439b0d1f3d8d43e/reserveRandomAvailable"

Request​

Responses​

A Json object of com.qmatic.qp.calendar.rest.dto.AppointmentDTO