Skip to main content
All CollectionsEnterpriseUse cases
How to Make a Booking With a Survey Using the API
How to Make a Booking With a Survey Using the API

Examples on how to use the Booxi booking API with survey answers.

Updated over a week ago
  • Use of this API requires a partner API Key. To obtain such a key, contact your Booxi representative.

  • Prior to use, consult Booxi's API fair use policy.

  • Remember that the URL at which you access the API depends on your hosting region. This article presents examples from a North American hosting only.

  • API documentation links:


Creating a booking

A new booking can be created by using the POST /booking endpoint, formatting the request body as shown below:

{
"merchantId": YOUR_MERCHANT_ID,
"bookingMethod": "Appointment",
"startsOn": "2000-01-01T12:00:00Z",
"status": "Approved",
"staffId": YOUR_STAFF_ID,
"items":
[
{
"serviceId": YOUR_SERVICE_ID
}
],
"client":
{
"firstName": "Mike",
"lastName": "Abbott",
"email": "mike.abbott@domain.com"
}
}

Creating an Appointment or Reservation With Survey Answers

The example below assumes that your webpage is displaying a survey using surveyjs.io or a compatible service. Your survey data should be formatted as shown below. The property surveyModel can be found in the “service” object as each service can be assigned a survey.

For more information about the “service” object, please consult the booking API OpenAPI definition under the section “schema”.

"surveyModel":
{
"pages":
[
{
"name": "default",
"elements":
[
{
"name": "_question1",
"type": "checkbox",
"title": "YOUR_QUESTION",
"choices": ["ANSWER 1","ANSWER 2","ANSWER 3","ANSWER 4"],
"isRequired": false
}
]
}
]
}

Once a survey has been filled out, surveyjs.io will provide the answers in a JSON object.

To create a new booking and include its survey answers, it is necessary to make a POST /booking with your data structured as shown below. Be mindful that data is structured differently for an appointment than it is for a group reservation.

Appointment Booking

For an “Appointment”, answers must be assigned to their respective items[].surveyAnswers and so for each service provided during that said appointment.


The example below showcases a “multi service” appointment with their sets of answers.

{
"merchantId": 001,
"bookingMethod": "Appointment",
"startsOn": "2022-02-20T16:00:00Z",
"status": "Approved",
"staffId": 001,
"items":
[
{
"serviceId": 1000,
"serviceName": "Service 1",
"price": {},
"reservedClientTimespan": {},
"duration": 30,
"spacingAfter": 0,
"isBusySpacingAfter": true
"surveyAnswers": {"_question1":["ANSWER 2"]}
},
{
"serviceId": 1001,
"serviceName": "Assembly",
"price": {},
"reservedClientTimespan": {},
"duration": 30,
"spacingAfter": 15,
"isBusySpacingAfter": false
"surveyAnswers": {"_question1":["ANSWER 4"]}
}
],
"client":
{
"firstName": "Mike",
"lastName": "Abbott",
"email": "mike.abbott@domain.com",
}
}

Group Reservation Booking

In the case of a group reservation, answers must be assigned to attendees[].surveyAnswers and so for each attendee of that reservation.

The below showcases a reservation with two attendees each with their respective survey answers.

{
"merchantId": YOUR_MERCHANT_ID,
"bookingMethod": "GroupReservation",
"groupEventId": YOUR_GROUP_EVENT_ID,
"client":
{
"firstName": "Mike",
"lastName": "Abbott",
"email": "mike.abbott@domain.com",
"isAttending": true
},
"attendees":
[
{
"firstName": "Mike",
"lastName": "Abbott",
"email": "mike.abbott@domain.com",
"isRequester": true,
"surveyAnswers": {"_question1":["ANSWER 1"]}
},
{
"firstName": "Laura",
"lastName": "Flynn",
"email": "laura.flynn@domain.com",
"isRequester": false,
"surveyAnswers": {"_question1":["ANSWER 3"]}
}
],
"clientCommunication": "ClientAndAttendees",
"createdBy": "Client"
}
Did this answer your question?