Get available slots from Zoho Bookings

Get available slots from Zoho Bookings

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>);
ParamsData typeDescription

<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:

  • You can get the ID of the record from the URL. The URL of a record in the service module is in the following format:
    https://bookings.zoho.com/#/app/manage-business/services/<service_id>/service-info
  • You can also use the invoke URL task to fetch records from the Services module. Visit Zoho Bookings API help and navigate to "Fetch Services" for API details. The response will contain the IDs of all the records, which can be extracted as illustrated in this sample snippet
  • You can also use zoho.bookings.getRelatedRecords task to fetch records from Services module and then the IDs of those records can be extracted as illustrated here.

<staff_id>

NUMBER

The ID of the staff associated with the service whose availability will be checked.

Note:

  • You can get the ID of the record from the URL. The URL of a record in staffs module is in the following format:
    ​https://bookings.zoho.com/#/app/manage-business/staffs/<staff_id>/staff-info
  • You can also use the invoke URL task to fetch records from the Staff module. Visit Zoho Bookings API help and navigate to "Fetch Staff" for API details. The response will contain the IDs of all the records, which can be extracted as illustrated in this sample snippet
  • You can also use zoho.bookings.getRelatedRecords task to fetch records from Staff module and then the IDs of those records can be extracted as illustrated here.

<date>

TEXT

The date for which the available time slots will be fetched.

<connection>

TEXT

The name of the connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter unless the authtoken is manually deleted from accounts.
  • Add relevant scopes while creating the connection.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

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
The variable which holds the response in KEY-VALUE format.
3883XXXXXXXXXXX7032
The NUMBER that represents the service ID.
3883XXXXXXXXXXX7008
The NUMBER that represents the staff ID.
"18-10-2019"
The TEXT that represents the date for which the available slots will be fetched.
"bookings_oauth_connection"
The TEXT that represents the connection name.

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"
     }
    }

Related Links

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com