Skip to content

Latest commit

 

History

History
351 lines (250 loc) · 17.7 KB

File metadata and controls

351 lines (250 loc) · 17.7 KB
title Bookings
nav_order 2

Attributes

NameTypeDescription
idIntegerAutomatically set
created_atDatetimeAutomatically set
updated_atDatetimeAutomatically set
service_idIntegerNot required
event_idIntegerNot required
resource_idIntegerRequired
person_idIntegerNot required
booked_fromDatetimeRequired
booked_toDatetimeRequired
expires_atDatetimeNot required
titleStringNot required
notesTextNot required
reminder_atDatetimeNot required
reminded_atDatetimeNot required
paid_atDatetimeNot required
external_idStringNot required
paid_amountDecimalNot required
revision_countIntegerAutomatically set
created_byStringAutomatically set
updated_byStringAutomatically set
external_urlStringNot required
external_host_urlStringNot required
booked_by_person_idIntegerNot required. Person who made the booking (e.g. parent booking for child).
verification_methodStringOnly for output.
location_urlStringOnly for output.
location_host_urlStringOnly for output.
custom_dataArrayNot required
stateStringAutomatically set. See states
activeBooleanAutomatically set
countIntegerDefault: 1
collection_idUUIDAutomatically set for recurring bookings.
statusStringDefault: null. See statuses.
person_attributesObjectSee person. Only for input.
personObjectSee person. Only for output.
resourceObjectSee resource. Only for output.
serviceObjectSee service. Only for output.
eventObjectSee event. Only for output.
booking_typeStringValues: appointment or attendance. See service.
coupon_idIntegerNot required

States

  • awaiting_verification
  • verification_expired
  • awaiting_payment
  • awaiting_confirmation
  • confirmed
  • 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.

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 specify: a booking by id, a specific state such as bookings that are awaiting confirmation, to return all bookings for a resource or dates, or for a person.

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/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 or cancelled. This is the preferred output if you want to provide a list of all bookings for visual presentation.

GET /bookings/no_status will return all active bookings with no status set.

Response

[
  {
    "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

NameTypeDescription
service_idInteger or array of integers
event_idInteger or array of integers
resource_idInteger or array of integers
person_idInteger or array of integers
external_idString
startDatetimebooked_from after param
endDatetimebooked_to before param
sinceDatetimeupdated_at after param
collection_idUUID
stateString or array of stringsSee states
statusString or array of stringsSee statuses

You can return bookings of multiple resources/services/events/people with an array.

Other Parameters

NameTypeDescription
extendedBooleanExtend output with full data from related objects.

Get booking

GET /bookings/{booking_id} will get booking with id {booking_id}.

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}.

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].

NameTypeDescription
public_bookingBooleanRestrict 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.

NameTypeDescription
confirmBooleanIf 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_capacityBooleanWill 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_smsBooleanAutomatically adds `reminder_at` based on setting from account attribute `sms_reminder_time`. Default: at 12PM the day before the appointment.
add_messagesBooleanAutomatically generate messages based on message templates. (NOTE: Beta functionality available by invitation.)
verification_send_emailBooleanSend out verification email. Only applicable when `confirm` is set to false.
verification_send_smsBooleanSend out verification SMS. Only applicable when `confirm` is set to false.
confirmation_send_emailBooleanSend out confirmation email.
confirmation_send_smsBooleanSend out confirmation SMS.
notification_send_emailBooleanSend out notification email to admin.
notification_send_smsBooleanSend out notification SMS to admin.
extendedBooleanExtend 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{:target="_blank"}. The attributes for recurrence are: RRULE, RDATE, EXDATE. For an introduction and examples of these parameters see this section from the iCalendar specification{:target="_blank"}.

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.

NameTypeDescription
rruleStringRepeating pattern. Example: `FREQ=DAILY;UNTIL=19971224T000000Z`.
rdateStringList of recurring dates. Example: `VALUE=DATE:19970101,19970120,19970217,19970421`.
exdateStringList of dates that should be excluded from the recurring rule. Example: `VALUE=DATE: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.

NameTypeDescription
confirmation_send_emailBooleanSend out confirmation email.
confirmation_send_smsBooleanSend out confirmation SMS.
notification_send_emailBooleanSend out notification email to admin. Default: based on account setting.
notification_send_smsBooleanSend out notification SMS to admin.
verification_codeStringVerification 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.

NameTypeDescription
confirmation_send_emailBooleanSend out confirmation email.
confirmation_send_smsBooleanSend out confirmation SMS.
notification_send_emailBooleanSend out notification email to admin.
notification_send_smsBooleanSend out notification SMS to admin.

Decline a booking

PUT /bookings/{booking_id}/decline will decline a booking.

Additional parameters

See information about additional parameters.

NameTypeDescription
decline_send_emailBooleanSend out decline email.
decline_send_smsBooleanSend out decline SMS.

Cancel a booking

PUT /bookings/{booking_id}/cancel will cancel a booking.

Additional parameters

See information about additional parameters.

NameTypeDescription
cancellation_send_emailBooleanSend out cancellation email.
cancellation_send_smsBooleanSend out cancellation SMS.

Update booking

PUT /bookings/{booking_id} will update a booking.

Additional parameters

See information about additional parameters.

NameTypeDescription
ignore_capacityBooleanSet to true to allow a double booking.
add_reminder_smsBooleanAutomatically adds `reminder_at`.
modification_send_emailBooleanSend out modification email.
modification_send_smsBooleanSend out modification SMS.
extendedBooleanExtend 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.

Additional parameters

See information about additional parameters.

NameTypeDescription
cancellation_send_emailBooleanSend out cancellation email.
cancellation_send_smsBooleanSend out cancellation SMS.

Update booking status

PUT /bookings/{booking_id}/status will update the booking status.

NameTypeDescription
statusStringBooking status.

This parameter is specified in the same way as additional parameters.