Bookings (add-on)
The diary: listing, booking, approving, cancelling, completing and moving a booking, and the CSV export.
Provided by the KahunaCart Bookings plugin. Reading takes kahunacart.bookings.view and changing anything takes kahunacart.bookings.manage, on top of api.access. What each action means for the customer is on Bookings and Troubleshoot.
List bookings
/api/v1/kahunacart/bookings
List bookings, newest first, with filters for a date range, a status, a customer, a product, an order or one person's column. Also answers how many are waiting for approval and how many are in conflict.
Parameters
| Name | Type | Description |
|---|---|---|
| from optional | string | Only bookings that end after this moment. Unix seconds, or a date and time. |
| to optional | string | Only bookings that start before this moment. Unix seconds, or a date and time. |
| status optional | string |
One booking status.
One of:
pending, confirmed, cancelled, rejected, completed, expired, waitlisted |
| customer_id optional | integer | Only this customer's bookings. |
| product_id optional | integer | Only bookings of this product. |
| order_id optional | integer | Only bookings that rode on this order. |
| bookable_id optional | integer | Only bookings sitting on this person, room or piece of equipment. |
| conflict optional | boolean | Only the ones where money arrived for a time the shop no longer had. |
| page optional | integer | Which page, from 1. |
| per_page optional | integer | How many per page, up to 200. |
| sort optional | string |
What to order by, across every booking that matches before the page is cut. Leave it out for the latest time first, and any other value is ignored. `service` and `with` are the names the list shows, and an empty value sorts last whichever way it runs.
One of:
start_at, created_at, status, reference, service, with, seats, order |
| dir optional | string |
Which way round. Latest first when left out.
One of:
asc, desc |
Book somebody in
/api/v1/kahunacart/bookings
Put somebody in the diary. Skips the notice period and the booking window, never the check that stops two people being given one chair. With take_payment it builds an order so there is a receipt; without it there is no order at all, which is what a walk-in paying on the day looks like.
Parameters
| Name | Type | Description |
|---|---|---|
| product_id required | integer | The booking product. |
| variant_id optional | integer | Which option of it — the sixty-minute one, the ninety-minute one. Required when taking payment. |
| start required | string | When it starts. Unix seconds, or a date and time in UTC. |
| seats optional | integer | How many places this takes. One for an ordinary appointment. |
| with optional | string | The person, room or piece of equipment the customer asked for, by its short name. Leave it out to let the shop choose. |
| tz optional | string | The timezone to record the appointment in. |
| email optional | string | The customer's email address. Required when taking payment. |
| name optional | string | The customer's name. |
| notes optional | string | Anything the shop wants on the booking. |
| take_payment optional | boolean | Build an order for this booking rather than leaving it to be paid on the day. |
| paid optional | boolean | With take_payment, mark the order already paid rather than awaiting payment. |
Read a booking
/api/v1/kahunacart/bookings/{id}
One booking in full, with the times it is sitting on and everything that has been done to it.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
Approve a booking request
/api/v1/kahunacart/bookings/{id}/approve
Say yes to a booking that was waiting for the shop to agree to it.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
Turn down a booking request
/api/v1/kahunacart/bookings/{id}/reject
Say no to a booking that was waiting. The time goes back. If the order behind it was paid, the money stays where it is and the answer says so — refunding is a separate decision.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
| reason optional | string | Why, for the trail. |
Cancel a booking
/api/v1/kahunacart/bookings/{id}/cancel
Call a booking off and give the time back. Never moves money; a paid booking raises a refund request for somebody to answer.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
| reason optional | string | Why, for the trail. |
Mark a booking as done
/api/v1/kahunacart/bookings/{id}/complete
Mark a booking as done. The hour it took stays spoken for.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
Mark a booking as a no-show
/api/v1/kahunacart/bookings/{id}/no-show
Record that somebody did not turn up, or take that mark off again. A flag rather than a status, because "they did not come" and "it is over" are two different facts.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
| no_show optional | boolean | True to mark it, false to clear it. Defaults to true. |
Move a booking
/api/v1/kahunacart/bookings/{id}/reschedule
Move a booking to a different time. The new time has to be one the shop is actually offering, the customer stays with whoever they asked for, and the order is not touched.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | The booking. |
| start required | string | The new start. Unix seconds, or a date and time in UTC. |
List the live holds
/api/v1/kahunacart/bookings/holds
Every time somebody is standing on right now while they finish paying. This is what answers "why can nobody book three o'clock".
Parameters
| Name | Type | Description |
|---|---|---|
| limit optional | integer | How many to show, up to 500. |
Export bookings as CSV
/api/v1/kahunacart/bookings/export
The filtered list as a CSV file, with the same filters as GET /kahunacart/bookings. No tool: it answers a file rather than JSON, and the list route answers the same rows.
A time going in is Unix seconds, or a date and time in UTC.