Booking Policies API: Sample Use Cases and Flows

This article shares some possible use cases your code could support, as well as a sample flow that could support each use case. This can be a helpful jumping off point as you plan your code's implementation.

Assign a booking policy to an existing service

Your code could allow the business owner to assign a booking policy to one of their services.

To assign a booking policy to a service:

  1. Call queryServices() to retrieve all relevant services and display them to the business owner. Make sure to save id and revision of the service for which the owner wants to change the booking policy.
  2. Use queryBookingPolicies() to retrieve all relevant booking policies and display them to the owner. Let them pick one and save the bookingPolicy.id.
  3. Optional: Allow the owner to create a new policy if they can't find a policy that meets all their needs by calling createBookingPolicy()). Let the owner input all relevant parameters for the policy and save the ID of the new policy.
  4. Call updateService() and provide service.id, service.revision, and service.booking.policy.id.

Change the default policy

Your code could allow the user to set a new default booking policy for their site.

To change the default policy:

  1. Call queryBookingPolicies() to retrieve all relevant booking policies and display them to the business owner. Let them choose a policy and save its ID.
  2. Optional: Allow the owner to create a new policy if they can't find a policy that meets all their needs by calling createBookingPolicy()). Let the owner input all relevant parameters for the policy and save the ID of the new policy.
  3. Call setDefaultBookingPolicy() and pass the relevant bookingPolicy.id.
Did this help?