Bookings
Attributes
| Name | Type | Description |
|---|---|---|
| id | Integer | Automatically set |
| created_at | Datetime | Automatically set |
| updated_at | Datetime | Automatically set |
| service_id | Integer | Not required |
| event_id | Integer | Not required |
| resource_id | Integer | Required |
| person_id | Integer | Not required |
| booked_from | Datetime | Required |
| booked_to | Datetime | Required |
| expires_at | Datetime | Only for output |
| title | String | Not required |
| notes | Text | Not required |
| reminder_at | Datetime | Only for output |
| reminded_at | Datetime | Only for output |
| paid_at | Datetime | Only for output |
| external_id | String | Not required |
| paid_amount | Decimal | Only for output |
| invoiced_at | Date | Only for output |
| revision_count | Integer | Automatically set |
| created_by | Integer | Automatically set. User id. |
| updated_by | Integer | Automatically set. User id. |
| external_url | String | Not required |
| external_host_url | String | Not required |
| booked_by_person_id | Integer | Only for output. Person who made the booking (e.g. parent booking for child). |
| verification_method | String | Only for output. |
| location_url | String | Only for output. |
| location_host_url | String | Only for output. |
| custom_data | Object | Not required. Key/value. Stored as strings. |
| state | String | Automatically set. See states |
| active | Boolean | Automatically set |
| count | Integer | Default: 1 |
| collection_id | UUID | Automatically set for recurring bookings. |
| status | String | Default: null. See statuses. |
| person_attributes | Object | See person. Only for input. |
| person | Object | See person. Only for output. |
| resource | Object | See resource. Only for output. |
| service | Object | See service. Only for output. |
| event | Object | See event. Only for output. |
| booking_type | String | Values: appointment or attendance. See service. |
| coupon_id | Integer | Not required |
States
- awaiting_verification
- verification_expired
- awaiting_payment
- awaiting_confirmation
- confirmed
- waitlisted
- declined
- cancelled
- deleted
Statuses
- checked_in
- in_progress
- completed
- no_show
Normal state flow
The normal booking flow when a customer initiates a new booking starts with awaiting_verification. If verification is required Makeplans sends out email or SMS for the customer to verify. When successfully verified the state is updated to confirmed or awaiting_confirmation if reservations requires confirmation by administrator. For confirmation it is then updated to confirmed as normally if confirmed, and to declined if it is not confirmed.
Bookings that have been confirmed and then cancelled, either by customer or administrator, are set to cancelled.
Bookings that are deleted are set to deleted.
Bookings on a waitlist are set to waitlisted. A waitlisted booking is not active and does not count towards capacity. It can be promoted to an active state, see promote.
Active bookings
Bookings with states awaiting_verification, awaiting_payment, awaiting_confirmation or confirmed are considered to be active. Bookings with state awaiting_verification will be updated with state verification_expired after the current time passes expires_at. However updating states rely on automatic tasks so you must use the active attribute to check whether a booking is active or not. Only active bookings will be returned unless you request a booking by id, specify a specific state such as bookings that are awaiting confirmation, or use the all or visible listings.
Listing
See query parameters for filtering the output beyond the default outputs.
GET /bookings will return all active bookings.
GET /bookings/recent will return all active bookings ordered based on updated_at.
GET /bookings/upcoming will return all future active bookings.
GET /bookings/unconfirmed will return only unconfirmed bookings.
GET /bookings/declined will return only declined bookings.
GET /bookings/cancelled will return only cancelled bookings.
GET /bookings/all will return all bookings of all states (including declined, cancelled, deleted, and verification_expired). This is a useful output for synchronisation when you need to keep a track of deleted bookings.
GET /bookings/visible will return all active bookings as well as those declined, cancelled or waitlisted. This is the preferred output if you want to provide a list of all bookings for visual presentation.
GET /bookings/no_status will return past confirmed bookings with a person where the status is not completed or no_show.
Abbreviated response. Responses include all attributes listed above, including the full person object and the related resource, service and event objects with id and title (use the extended parameter for their full data).
[
{
"booking": {
"booked_from": "2012-09-29T07:00:00+02:00",
"booked_to": "2012-09-29T08:00:00+02:00",
"created_at": "2012-09-20T15:34:16+02:00",
"custom_data": null,
"count": 1,
"expires_at": null,
"external_id": null,
"id": 1,
"notes": "Very handsome customer",
"person_id": 1,
"resource_id": 1,
"service_id": 1,
"state": "confirmed",
"status": null,
"updated_at": "2012-09-20T15:34:16+02:00"
}
}
]
Query Parameters
| Name | Type | Description |
|---|---|---|
| service_id | Integer or array of integers | |
| event_id | Integer or array of integers | |
| resource_id | Integer or array of integers | |
| person_id | Integer or array of integers | |
| external_id | String | |
| start | Datetime | booked_to after param. Combine with end to return all bookings that overlap the period. Also accepts the values now and today. |
| end | Datetime | booked_from before param. Also accepts the values now and today. |
| since | Datetime | updated_at after param. Also accepts the values now and today. |
| collection_id | UUID | |
| state | String or array of strings | See states |
| status | String or array of strings | See statuses |
| exclude | Integer | Exclude booking with this id. |
| booking_type | String | See booking_type on service. |
| order | String | Values: changes (updated_at desc), booked_from_asc, booked_from_desc. |
You can return bookings of multiple resources/services/events/people with an array.
Other Parameters
| Name | Type | Description |
|---|---|---|
| extended | Boolean | Extend output with full data from related objects. |
Get booking
GET /bookings/{booking_id} will get booking with id {booking_id}.
The extended parameter is also available for get booking.
You can also find a booking with external_id:
GET /bookings/find_by/external_id/{external_id} will get booking with external_id {external_id}.
PUT /bookings/find_by/external_id/{external_id} and DELETE /bookings/find_by/external_id/{external_id} will update or delete the booking with external_id {external_id}.
Add new booking
POST /bookings will create a new booking.
Bookings without person_id are shown as busy in the calendar.
Non-returning booking parameters
These parameters are part of booking: booking[public_booking].
| Name | Type | Description |
|---|---|---|
| public_booking | Boolean | Restrict to normal public booking rules such as within opening hours, not able to book in the past or past specified allowed date in the future. Recommended for all customer facing booking applications (e.g. integration on website). Not recommended when synchronising with other calendar programs. Default: false. |
Additional parameters
These parameters are not part of booking[]: confirm.
Outgoing messages requires person_id and service_id.
Default action for outgoing messages is according to the settings for booking verification. If email verification is enabled then all *_email messages will be triggered by default to the customer. To override please see parameters for each action below. For admin notification messages the default is based on the account settings. SMS reminders is based on account settings and uses a default value for the time unless specified.
| Name | Type | Description |
|---|---|---|
| confirm | Boolean | If set to false then the 'initiate verification' event is executed. If verification is required the state will be set to `awaiting_verification`. If no verification is required then the state will be set to `awaiting_confirmation` or `confirmed`. |
| ignore_capacity | Boolean | Will force save the booking even though other bookings exists within the same time on the specified resource_id (double booking). Not applicable when `public_booking` is set to true (no double bookings allowed). Default: false. |
| add_reminder_sms | Boolean | Automatically adds `reminder_at` based on setting from account attribute `sms_reminder_time`. Default: at 12PM the day before the appointment. |
| add_messages | Boolean | Automatically generate messages based on message templates. (NOTE: Beta functionality available by invitation.) |
| verification_send_email | Boolean | Send out verification email. Only applicable when `confirm` is set to false. |
| verification_send_sms | Boolean | Send out verification SMS. Only applicable when `confirm` is set to false. |
| confirmation_send_email | Boolean | Send out confirmation email. |
| confirmation_send_sms | Boolean | Send out confirmation SMS. |
| notification_send_email | Boolean | Send out notification email to admin. |
| notification_send_sms | Boolean | Send out notification SMS to admin. |
| extended | Boolean | Extend output with full data from related objects. |
Add new booking with new person
To add a new person along with a booking you must populate person_attributes with person attributes. Values will be matched to an existing person based on national id number, phone number or email (in that order).
Add recurring bookings
POST /bookings/recurring will create recurring bookings based on a pattern.
The recurrence format follows the iCalendar specification. The attributes for recurrence are: RRULE, RDATE, EXDATE. For an introduction and examples of these parameters see this section from the iCalendar specification.
In the iCalendar specification the recurrence is based on values in DTSTART and DTEND. This is set by booked_from and booked_to from booking.
All recurring bookings will except for booked_from and booked_to have the same attributes based on the specified parameters in booking.
All bookings created by the recurring pattern gets the same UUID in collection_id. As the collection name implies, and as is possible with the iCalendar specification, this is not necessarily only for recurrence (i.e. 9am-10am each Friday until December 1st) but also for multiple specific times (as can be specified with RDATE).
Only the collection_id is returned. No bookings are created at the time of request as they will be processed by the server in the background due to the volume of bookings that it is possible to create at one time. A successful response with a collection_id does in no way indicate that any bookings will be created. The first booking as defined in booking is however validated. If it is not valid errors details are returned in the same way as creating a single booking. In such a case recurring rules are not applied and you must adjust the request until validation is successful.
Parameters for recurrence
The parameters for recurrence are not set in booking but in recurring.
| Name | Type | Description |
|---|---|---|
| rrule | String | Repeating pattern. Example: `FREQ=DAILY;UNTIL=19971224T000000Z`. |
| rdate | String | Comma separated list of recurring dates. Example: `19970101,19970120,19970217,19970421`. |
| exdate | String | Comma separated list of dates that should be excluded from the recurring rule. Example: `19970102`. |
You should always specify COUNT or UNTIL with RRULE. The max number of occurrences is 731, regardless if a limit is set or not.
List occurrences
GET /bookings/recurring/{collection_id} will return all occurrences for a collection.
Cancel all occurrences
PUT /bookings/recurring/{collection_id}/cancel will cancel all occurrences for a collection.
Delete all occurrences
DELETE /bookings/recurring/{collection_id} will delete all occurrences for a collection.
Change booking state
Verify a booking
PUT /bookings/{booking_id}/verify will verify a booking. The verification code is not checked. Use this when you handle verification in your application.
Verify a booking with verification code
PUT /bookings/{booking_id}/verify_code will verify a booking using {verification_code}. Use this when Makeplans is used to send out verification email or SMS.
Additional parameters
See information about additional parameters.
| Name | Type | Description |
|---|---|---|
| confirmation_send_email | Boolean | Send out confirmation email. |
| confirmation_send_sms | Boolean | Send out confirmation SMS. |
| notification_send_email | Boolean | Send out notification email to admin. Default: based on account setting. |
| notification_send_sms | Boolean | Send out notification SMS to admin. |
| awaiting_confirmation_send_email | Boolean | Send out awaiting confirmation email. Only applicable when the verified booking requires confirmation by administrator. |
| awaiting_confirmation_send_sms | Boolean | Send out awaiting confirmation SMS. Only applicable when the verified booking requires confirmation by administrator. |
| verification_code | String | Verification code send using SMS or email. Only applicable for the `verify_code` action. |
Confirm a booking
PUT /bookings/{booking_id}/confirm will confirm a booking.
Additional parameters
See information about additional parameters.
| Name | Type | Description |
|---|---|---|
| confirmation_send_email | Boolean | Send out confirmation email. |
| confirmation_send_sms | Boolean | Send out confirmation SMS. |
| notification_send_email | Boolean | Send out notification email to admin. |
| notification_send_sms | Boolean | Send out notification SMS to admin. |
Decline a booking
PUT /bookings/{booking_id}/decline will decline a booking.
Additional parameters
See information about additional parameters.
| Name | Type | Description |
|---|---|---|
| decline_send_email | Boolean | Send out decline email. |
| decline_send_sms | Boolean | Send out decline SMS. |
Cancel a booking
PUT /bookings/{booking_id}/cancel will cancel a booking.
Additional parameters
See information about additional parameters.
| Name | Type | Description |
|---|---|---|
| cancellation_send_email | Boolean | Send out cancellation email. |
| cancellation_send_sms | Boolean | Send out cancellation SMS. |
| notification_send_email | Boolean | Send out notification email to admin. |
| notification_send_sms | Boolean | Send out notification SMS to admin. |
Promote a booking from the waitlist
PUT /bookings/{booking_id}/promote will promote a booking with state waitlisted. The booking is promoted even if there is no available capacity. The new state follows the normal state flow: confirmed, awaiting_payment or awaiting_confirmation.
Update booking
PUT /bookings/{booking_id} will update a booking.
Additional parameters
See information about additional parameters.
| Name | Type | Description |
|---|---|---|
| ignore_capacity | Boolean | Set to true to allow a double booking. |
| add_reminder_sms | Boolean | Automatically adds `reminder_at`. |
| modification_send_email | Boolean | Send out modification email. |
| modification_send_sms | Boolean | Send out modification SMS. |
| notification_send_email | Boolean | Send out notification email to admin. |
| notification_send_sms | Boolean | Send out notification SMS to admin. |
| extended | Boolean | Extend output with full data from related objects. |
Delete booking
DELETE /bookings/{booking_id} will delete existing booking with id {booking_id}.
Deleting a booking will set it to state=deleted and active=false. It will not be visible in listing, only when requesting GET /bookings/all or by requesting the booking directly GET /bookings/{booking_id}.
Do not use this method if the booking is rescheduled or cancelled. No cancellation email or SMS is sent when deleting a booking. Use cancel to notify the customer.
Update booking status
PUT /bookings/{booking_id}/status will update the booking status.
| Name | Type | Description |
|---|---|---|
| status | String | Booking status. |
This parameter is specified in the same way as additional parameters.