Get available slots from Zoho Bookings
Table of Contents
Overview
This task is used to fetch a list of available slots for the given service and staff on the specified date.
This task is based on Zoho Bookings API - Fetch Availability.
Syntax
<response> = zoho.bookings.getAvailableSlots(<service_id>, <staff_id>, <date>, <connection>);
Params | Data type | Description |
<response> | KEY-VALUE | Variable which will hold the returned response. |
<service_id> | NUMBER | The ID of the service whose available slots will be fetched. Note:
|
<staff_id> | NUMBER | The ID of the staff associated with the service whose availability will be checked. Note:
|
<date> | TEXT | The date for which the available time slots will be fetched. |
<connection> | TEXT | The name of the connection. Note:
|
Example
The following script fetches all the available slots for the service of ID - 3883XXXXXXXXXXX7032 and staff of ID - 3883XXXXXXXXXXX7008 on 18-10-2019:
response = zoho.bookings.getAvailableSlots(3883XXXXXXXXXXX7032, 3883XXXXXXXXXXX7008, "18-10-2019", "bookings_oauth_connection");
where:
response
3883XXXXXXXXXXX7032
3883XXXXXXXXXXX7008
"18-10-2019"
"bookings_oauth_connection"
Response Format
Success Response
- The success response will be returned in the following format:{
"response": {
"returnvalue": {
"reponse": true,
"data": [
"15:15",
"15:30",
"15:45",
"16:00",
"16:15",
"16:30",
"16:45"
],
"time_zone": "Asia/Calcutta"
},
"status": "success"
}
}
To get the time zone, you can use the following script:
<variable> = response.get("response").get("returnvalue").get("time_zone");
To extract the list of available slots, you can use the following script:
<variable> = response.get("response").get("returnvalue").get("data");
Failure Response
- The failure response for an invalid or non-existent service ID will be returned in the following format:{
"response": {
"returnvalue": {
"message": "Service not found",
"status": "failure"
},
"status": "success"
}
} - The failure response for an invalid or non-existent staff/resource ID will be returned in the following format:{
"response": {
"returnvalue": {
"message": "Staff not found",
"status": "failure"
},
"status": "success"
}
}