Skip to content

Powered by Grav CMS + Helios Theme

Booking services (add-on)

What a product means as a booking: how long, how often, how far ahead, and what it needs.

A service is the booking rule written for a product, or for one of its options. The writes are PUT rather than POST, because there is one rule per product and one per option, and writing it twice has to mean the same as writing it once. See Services.

List the booking products

GET /api/v1/kahunacart/bookings/setup/products Permission kahunacart.bookings.view

Every product of type Booking, with its options and whether a booking rule has been written for each. A product with no rule cannot be booked at all, and this is what says which those are.

List services

GET /api/v1/kahunacart/bookings/setup/services Permission kahunacart.bookings.view

Every product the shop books, with how long it takes, how often a start is offered, what it needs, and the product it hangs off.

Write a products booking rule

PUT /api/v1/kahunacart/bookings/setup/services/{productId} Permission kahunacart.bookings.manage

Write the booking rules for a product — how long, how often, how much notice, how far ahead, and whether it is confirmed straight away or waits for the shop to agree. This is the rule for every option of the product that has none of its own.

Parameters

Name Type Description
productId required integer The product.
duration optional integer How long it takes, in minutes.
slot_interval optional integer How often a start is offered, in minutes. Leave it out to follow the store's own setting.
buffer_before optional integer Setting-up time before it, in minutes.
buffer_after optional integer Clean-up time after it, in minutes.
capacity optional integer How many separate bookings share one slot. One for an appointment, the places on each date for a class.
party_size optional integer How many people one booking of this may be for. Four to a range lane, six to a studio, one for a haircut. It never changes what is claimed — a party of four still takes one lane — so it is not capacity. Appointments only; a class counts every person as a place and ignores it.
names_say_length optional boolean Whether this rule's options are already named after how long they take. True where they are called "An hour" and "Ninety minutes", so the storefront prints the name and the price and leaves the minutes out; false where they are called "Small dog" and "Large dog". Appointments only, and false unless somebody said otherwise.
notice_hours optional integer How much warning the shop wants, in hours.
window_days optional integer How far ahead it can be booked, in days.
cutoff_hours optional integer How late a customer may still change it themselves, in hours before the start.
workflow optional string Whether it is booked straight away or waits for somebody to say yes.
One of: instant, approval
payment optional string Whether the money is taken in the basket or handed over on the day.
One of: online, on_the_day
mode optional string Open availability, or fixed sessions from a repeating pattern.
One of: appointment, session
schedule_id optional integer The hours to fall back on when nobody else has any.
location_id optional integer Where it happens.
enabled optional boolean Whether this is bookable at all.

Write an options booking rule

PUT /api/v1/kahunacart/bookings/setup/services/{productId}/{variantId} Permission kahunacart.bookings.manage

Write the booking rules for one option of a product, replacing the product's own rule for that option only. This is how "sixty minutes, fifty-five pounds" and "ninety minutes, eighty" get a length each.

Parameters

Name Type Description
productId required integer The product.
variantId required integer The option.
duration optional integer How long it takes, in minutes.
slot_interval optional integer How often a start is offered, in minutes.
buffer_before optional integer Setting-up time before it, in minutes.
buffer_after optional integer Clean-up time after it, in minutes.
capacity optional integer How many separate bookings share one slot.
party_size optional integer How many people one booking of this may be for. It never changes what is claimed — a party of four still takes one lane — so it is not capacity. Appointments only.
names_say_length optional boolean Whether this rule's options are already named after how long they take. True where they are called "An hour" and "Ninety minutes", so the storefront prints the name and the price and leaves the minutes out; false where they are called "Small dog" and "Large dog". Appointments only, and false unless somebody said otherwise.
notice_hours optional integer How much warning the shop wants, in hours.
window_days optional integer How far ahead it can be booked, in days.
cutoff_hours optional integer How late a customer may still change it themselves, in hours.
workflow optional string Whether it is booked straight away or waits for somebody to say yes.
One of: instant, approval
payment optional string Whether the money is taken in the basket or handed over on the day.
One of: online, on_the_day
schedule_id optional integer The hours to fall back on.
location_id optional integer Where it happens.
enabled optional boolean Whether this option is bookable at all.

Remove a booking rule

DELETE /api/v1/kahunacart/bookings/setup/services/{id} Permission kahunacart.bookings.manage

Stop booking a product, or stop one of its options having a rule of its own. What the service needed goes with it; bookings already made stay exactly where they are.

Parameters

Name Type Description
id required integer The rule.

List what a service needs

GET /api/v1/kahunacart/bookings/setup/services/{serviceId}/needs Permission kahunacart.bookings.view

What a service occupies — one groomer from Ann or Bo with the customer choosing, and the tub with no choice — each with the pool it draws on.

Parameters

Name Type Description
serviceId required integer The rule.

Add a need to a service

POST /api/v1/kahunacart/bookings/setup/services/{serviceId}/needs Permission kahunacart.bookings.manage

Say that a service occupies one more thing. A time is only offered when every need can be met at once.

Parameters

Name Type Description
serviceId required integer The rule.
label required string What to call this need on screen and in a refusal — Groomer, Tub, Room.
units optional integer How many of the thing it takes. Two lanes is two.
customer_chooses optional boolean Whether the customer picks who or what, or the shop does.
position optional integer Where it comes in the order needs are worked through.
bookables optional array of integer The pool it draws on, in the order they should be tried.

Update a need

PATCH /api/v1/kahunacart/bookings/setup/needs/{id} Permission kahunacart.bookings.manage

Change what a service occupies, or who is in the pool. Leaving the pool out keeps it as it is; sending an empty pool empties it.

Parameters

Name Type Description
id required integer The need.
label optional string What to call it.
units optional integer How many of the thing it takes.
customer_chooses optional boolean Whether the customer picks.
position optional integer Where it comes in the order.
bookables optional array of integer The pool, in the order they should be tried.

Remove a need

DELETE /api/v1/kahunacart/bookings/setup/needs/{id} Permission kahunacart.bookings.manage

Stop a service occupying something. A service left with no needs at all books against itself, which is the one-person shop.

Parameters

Name Type Description
id required integer The need.