Core API Documentation
Bookings and Leases
Register a person into an event or series of events. You can also temporarily hold a space in one or more events, then register for all of them at once. Bookings can be associated w/ Invoices & will be automatically completed once the Invoice is closed.
Lease: a temporary reservation on a Group Class, Course or Appointment. For Group Classes, this can be a single occurrence, or a recurring enrollment. For Appointments this can be a single occurrence. For a Course, it should be for the entire run of event occurrences. A person must be associated with the Lease before the Booking can be completed.
Booking: a collection of Leases. You can create a Booking with zero or more Leases. When the Booking is in the incomplete state, the Leases are just holding a space in that Group Class, Course or Appointment. When a Booking is completed, the Leases will go from reserved to registered.
Uncompleted Bookings will eventually expire. When it expires, it will release the spaces leased in each event.
The default expiration is 10 minutes, but can be set using the
Front
GET /api/v2/front/bookings/:id
Returns the given Booking if it is owned by the person currently authenticated.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
GET /api/v2/front/bookings/:booking_id/leases/:id
Returns the given Lease if it is owned by the person currently authenticated.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases/1
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
PUT /api/v2/front/bookings/:id
Allows you to complete a Booking. You cannot add any more Leases to the Booking using this endpoint. To add or update Leases use the Leases endpoint.
REQUEST
$ curl -X PUT https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "booking": { "complete_booking": true } }'
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
PUT /api/v2/front/bookings/:booking_id/leases/:id
Allows you to update a Lease. The only thing that can be updated on the Lease is the person associated with it. You cannot change the leased service. You would need to delete the Lease and create a new one if you want to change the service.
REQUEST
$ curl -X PUT https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases/1 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "lease": { "person": { "id": 1 } } }'
RESPONSE
{
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
DELETE /api/v2/front/bookings/:id
Destroys the given Booking.
If the Booking was completed, then just the Booking will be destroyed. The Visits and Invoices that it created won't be destroyed. If the Booking was not completed, it and any Leases, visits, plans and invoices created by it will be destroyed.
i.e. If the person has paid and been registered for the events, only the Booking will be deleted. If they have not paid, then we'll destroy their reservations and the Invoice.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful
DELETE /api/v2/front/bookings/:booking_id/leases/:lease_id
Destroys the given Lease, any reservations it's holding, and removes it from the Booking. You can only delete a Lease from a Booking that has not been completed.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases/1 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX"
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful
POST /api/v2/front/bookings
Creates a Booking with one or more Leases.
Parameters
| idempotency_token | string | A unique string that you can send with the Booking to ensure that you don't send the same request twice. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| expires_at | timestamp | A date and time to expire this Booking. Capacity in an event will be held by this Booking, so don't set this too long. Default is 10 minutes, maximum is 20 minutes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| complete_booking | boolean | This will set each visit in the Booking from reserved state to the registered state. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| leases | array | Optional: Array of Leases to be created. Each Lease must be one of the following collections of information depending on the type of service leased: Event Occurrence
Appointment
Recurring Event (Group Classes)
Course
|
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/bookings \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"booking": {
"idempotency_token": "A_STRING_UNIQUE_TO_THIS_BOOKING",
"complete_booking": true,
"leases": [
{
"event_occurrence_id": 1000,
"person": {
"id": 1
}
}
]
}
}'
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
POST /api/v2/front/bookings/:booking_id/leases
Add a Lease to a Booking. The parameters for the Lease are the same as the Lease parameters in a Booking. Choose from the different parameter sets listed below:
Event Occurrence Parameters
| event_occurrence_id | integer | The id of an event occurrence. | |||
|---|---|---|---|---|---|
| person | object | An existing person to put on this Lease
|
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "lease": { "event_occurrence_id": 1000, "person": { "id": 1 } } }'
RESPONSE
{
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
Appointment Parameters
| service_id | integer | The id of a service. | |||
|---|---|---|---|---|---|
| staff_member_id | integer | The id of a staff member. If two (or more) of the same service occur at the same time, including the staff member will help differentiate which one is desired. | |||
| location_id | integer | The id of the location. If the same service is available at more than one location, including the location will help differentiate between the services. | |||
| start_at | timestamp | The time when the appointment starts | |||
| person | object | An existing person to put on this Lease
|
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"lease": {
"service_id": 2000,
"staff_member_id": 20,
"location_id": 1000,
"start_at": "2017-10-18T20:00:00Z",
"person": {
"id": 1
}
}
}'
RESPONSE
{
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
Recurring Event Paramters
| event_id | integer | The id of the recurring event. | |||
|---|---|---|---|---|---|
| start_at | timestamp | The time of the first event to attend. | |||
| recurring | boolean | Whether or not to enroll in this event on an ongoing basis. | |||
| person | object | An existing person to put on this Lease
|
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"lease": {
"event_id": 1,
"start_at": "2017-10-19T17:00:00Z",
"recurring": true,
"person": {
"id": 1
}
}
}'
RESPONSE
{
"leases": [
{
"id": 1,
"event_id": 1,
"start_at": "2017-10-19T17:00:00Z",
"event_person_id": 1,
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
Course Parameters
| event_id | integer | The id of the course event. | |||
|---|---|---|---|---|---|
| start_at | timestamp | Optional. The date and time of the first event to attend. If empty will set to today. | |||
| person | object | An existing person to put on this Lease
|
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/front/bookings/12345678-9012-3456-7890-123456789012/leases \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"lease": {
"event_id": 1,
"start_at": "2017-10-19T17:00:00Z",
"person": {
"id": 1
}
}
}'
RESPONSE
{
"leases": [
{
"id": 1,
"event_id": 1,
"start_at": "2017-10-19T17:00:00Z",
"event_person_id": 1,
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
Desk
GET /api/v2/desk/bookings/:id
Returns the given Booking.
REQUEST
$ curl https://mybiz.pike13.com/api/v2/desk/bookings/1
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
DELETE /api/v2/desk/bookings/:id
Destroys the given Booking.
If the Booking was completed, then just the Booking will be destroyed. The Visits and Invoices that it created won't be destroyed. If the Booking was not completed, it and any Leases, visits, plans and invoices created by it will be destroyed.
i.e. If the person has paid and been registered for the events, only the Booking will be deleted. If they have not paid, then we'll destroy their reservations and the Invoice.
REQUEST
$ curl -X DELETE https://mybiz.pike13.com/api/v2/desk/bookings/12345678-9012-3456-7890-123456789012
RESPONSE
HTTP 204 if successful
HTTP 4xx if unsuccessful
PUT /api/v2/desk/bookings/:id
Allows you to complete a Booking. You cannot add any more Leases to the Booking using this endpoint. To add or update Leases use the Leases endpoint.
REQUEST
$ curl -X PUT https://mybiz.pike13.com/api/v2/desk/bookings/12345678-9012-3456-7890-123456789012 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "booking": { "complete_booking": true } }'
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
PUT /api/v2/desk/bookings/:booking_id/leases/:id
Allows you to update a Lease. The only thing that can be updated on the Lease is the person associated with it. You cannot change the leased service. You would need to delete the Lease and create a new one if you want to change the service.
You can add an existing person by id or email. You can create a new person with a minimum of first_name, last_name, and email; other fields are optional
Parameters
| person | object | A new or existing person to put on this Lease:
|
|---|
REQUEST
$ curl -X PUT https://mybiz.pike13.com/api/v2/desk/bookings/12345678-9012-3456-7890-123456789012/leases/1 \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{ "lease": { "person": { "first_name": "Best", "last_name": "Client", "email": "client@example.com" } } }'
RESPONSE
{
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
POST /api/v2/desk/bookings
Creates a Booking with one or more Leases.
Parameters
The parameters to the Desk endpoint are the same as the Front endpoint, with the addition of the
- Add existing person to the Lease by id
- Add existing person to the Lease by email
- Create a person with a minimum of first_name, last_name, and email; other fields are optional
- Ignore the capacity of the event when creating a Lease (allows over-booking)
| leases | array | Array of Leases using one of the following collections of information:
|
|---|
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/bookings \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"booking": {
"idempotency_token": "A_STRING_UNIQUE_TO_THIS_BOOKING",
"complete_booking": true,
"leases": [
{
"event_occurrence_id": 1000,
"allow_overbook": true,
"person": {
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client"
}
}
]
}
}'
RESPONSE
{
"bookings": [
{
"expires_at": "2017-10-16T22:08:08Z",
"completed_at": "2017-10-16T21:58:23Z",
"id": "12345678-9012-3456-7890-123456789012",
"owner_id": 1,
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}
]
}
POST /api/v2/desk/bookings/:booking_id/leases
Add a new Lease to an existing Booking.
Parameters
The parameters to the Desk endpoint are the same as the Front endpoint, with the addition of the
- Add existing person to the Lease by id
- Add existing person to the Lease by email
- Create a person with a minimum of first_name, last_name, and email; other fields are optional
- Ignore the capacity of the event when creating a Lease (allows over-booking)
| person | object | An existing person to put on this Lease
| ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| allow_overbook | boolean | True to allow over-booking the event when creating a Lease. Default false. |
REQUEST
$ curl -X POST https://mybiz.pike13.com/api/v2/desk/bookings/12345678-9012-3456-7890-123456789012/leases \
-H "Authorization: Bearer XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"lease": {
"event_occurrence_id": 1000,
"allow_overbook": true,
"person": {
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client"
}
}
}'
RESPONSE
{
"leases": [
{
"id": 1,
"visit_id": 1,
"event_id": 1,
"event_occurrence_id": 1000,
"service_id": 2000,
"location_id": 1000,
"staff_members": [
{
"id": 20,
"name": "Jane Fitness"
},
{
"id": 21,
"name": "Joe Fitness"
}
],
"start_at": "2017-10-17T17:00:00Z",
"person": {
"id": 1,
"email": "client@example.com",
"first_name": "Best",
"last_name": "Client",
"address": null,
"business_id": 1
}
}
]
}