Get available slots from Zoho Bookings
Table of Contents
Note:
- Each time the zoho.bookings.getAvailableSlots integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.bookings.getAvailableSlots integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
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"
}
}