Skip to content

Bookings API

Dax Huiberts edited this page Jul 31, 2018 · 15 revisions

General

This page describes several internal API's used to check availability and create online bookings for companies. It might be possible that a 3rd party encounters issue for example with CORS. Please get in touch with us to get whitelisted.

Context

Every company has their own unique subdomain. Any API call listed here is called within the micro site of the customer. For example you can check out our demo micro site on https://salonized.salonized.com

Booking config

Config data to configure booking widget according to salon admin settings

URL: https://salonized.salonized.com/bookings/booking_config.json
RESPONSE:

{
  "company": {
    "field_order": ["service", "location", "resource"],
    "show_service_prices": true,
    "allow_multiple_services": false,
    "resource_selection": "manual",
    "address_fields": "hidden"
  }
}

field_order defines the order of the service, location and resource selects.

show_service_prices is a boolean which states whether services prices should be visible.

allow_multiple_services is a boolean which states whether only one or multiple services should be selectable.

resource_selection can be one of:

  • automatic: don't show resource select and choose one implicitly.
  • manual: show resource select, but make it optional.
  • required: show resource select and make it required.

address_field can be one of:

  • hidden: don't show address fields.
  • optional: show address fields, but can be blank.
  • required: show address fields and should be filled in.

Locations list

Feed that lists all locations with their name and address details.

URL: https://salonized.salonized.com/bookings/locations.json
RESPONSE:

{
  "locations": [{
    "id": 1234,
    "internal_name": "Amsterdam",
    "name": "Salonized Amsterdam HQ",
    "address": "Herengracht 575",
    "postalcode": "1017 CD",
    "city": "Amsterdam",
    "phone": "020-8932386",
    "sort_order": 0
  }]
}

Resources list

Feed that lists all resources (employees) and the location they belong to.

URL: https://salonized.salonized.com/bookings/resources.json
RESPONSE:

{
  "resources/employees": [{
    "id": 1234,
    "location_id": 123,
    "name": "James Bond",
    "type": "employee"
  }, {
    "id": 5678,
    "location_id": 123,
    "name": "Austin Powers",
    "type": "employee"
  }]
}

It's also possible to retrieve only the resources for a specific location_id and/or a service:

URL: https://salonized.salonized.com/bookings/resources.json?location_id=123&services=1234
RESPONSE:

{
  "resources/employees": [{
    "id": 1234,
    "location_id": 123,
    "name": "James Bond",
    "type": "employee"
  }]
}

Services list

Feed that lists all bookable services including their price and duration.

URL: https://salonized.salonized.com/bookings/services.json
RESPONSE:

{
  "services": [{
    "id": 1234,
    "name": "Botox behandeling",
    "sort_order": 0,
    "duration": 30,
    "buffer": 0,
    "price": 10000,
    "category_id": 36654,
    "category_name": "Algemeen"
  }, {
    "id": 5678,
    "name": "Gelaatsbehandeling",
    "sort_order": 0,
    "duration": 75,
    "buffer": 0,
    "price": 5000,
    "category_id": 36654,
    "category_name": "Algemeen"
  }]
}

It's also possible to retrieve only the services for specific resource_id:

URL: https://salonized.salonized.com/bookings/services.json?resource_id=1234
RESPONSE:

{
  "services": [{
    "id": 5678,
    "name": "Gelaatsbehandeling",
    "sort_order": 0,
    "duration": 75,
    "buffer": 0,
    "price": 5000,
    "category_id": 36654,
    "category_name": "Algemeen"
  }]
}

Available days

With a specified service and a given start date you can get a list with all dates that have at least one opening. This endpoint will return results for a maximum of 6 weeks from the given start date.

ENDPOINT: https://salonized.salonized.com/bookings/available_days?service_ids=24956,4750&date=2017-12-01
RESPONSE:

{
  "days": [
    "2017-12-01",
    "2017-12-02",
    "2017-12-03",
    "2017-12-04",
    "2017-12-05",
    "2017-12-06",
    "2017-12-07",
    "2017-12-08"
  ]
}

Available times

When you have one or more service ids and a date you can query all available times for this combination of service ids. When supplying multiple id's we see this as one appointment with multiple services scheduled after each other.

ENDPOINT: https://salonized.salonized.com/bookings/timeslots?service_ids=24956,4750&date=2018-06-07
RESPONSE:

[
  {
  	"full_date": "2018-06-07 09:00",
  	"date": "2018-06-07",
  	"time": "09:00",
  	"display_time": "09:00",
  	"resource_id": 767,
  	"day_part": "morning"
  }, {
  	"full_date": "2018-06-07 09:15",
  	"date": "2018-06-07",
  	"time": "09:15",
  	"display_time": "09:15",
  	"resource_id": 767,
  	"day_part": "morning"
  }
]

Create booking

METHOD: POST
ENDPOINT: https://salonized.salonized.com/bookings
POST DATA:

booking[resource_id]: 356
booking[service_ids][]: 24956
booking[service_ids][]4750
booking[appointment_at]: 2017-12-24 09:00
booking[first_name]: Danny
booking[last_name]: Hiemstra
booking[address]: Herengracht 575
booking[postalcode]: 1017CB
booking[city]: Amsterdam
booking[phone]: 0612345678
booking[email]: danny@salonized.com
booking[notes]: Notes

Clone this wiki locally