β
POST - Book a resource
Purpose
This API helps in booking a resource. As of now, Room booking alone is supported in Resource Booking.
Request URL
https://calendar.zoho.com/api/v1/bookings
OAuth Scope
scope=ZohoCalendar.bookings.ALL
or
scope=ZohoCalendar.bookings.CREATE
β
ALL - Access to all bookings
CREATE - Books a resource
Request Parameters
- bookingDataJSONObject, mandatory
- This is a mandatory JSON that has the key parameters like title, attendees, date and time, and so on as listed as BookingJson.
- BookingJson:
- titlestring, mandatory
- A title should be given to each booking you make in Resource Booking.
- dateandtimeJSONObject, mandatory
- The DateandtimeJSON has the values of the starting and ending time and date along with the time zone.
- DateandtimeJson:β
- startstring, mandatory
- The start parameter denotes the start date and time from which the free/busy details should be retrieved.
- The supported format for the start parameter is iso8601basic (yyyyMMdd'T'HHmmss).
- (yyyy - Year, MM - Month, dd - Date, HH - Hours, mm - Minutes, ss - Seconds.)
- Example: 20170419T080000
- endstring, mandatory
- The end parameter denotes the end date and time from which the free/busy details should be retrieved.
- The supported format for the start parameter is iso8601basic (yyyyMMdd'T'HHmmss).
- (yyyy - Year, MM - Month, dd - Date, HH - Hours, mm - Minutes, ss - Seconds.)
- Example: 20170419T080000
- timezonestring, mandatory
- Mention the time zone in which the event is to be organized.
- isprivateboolean, optional
- If the boolean value is "true" then the booking is private and will be shown as a private booking to other users.
- If the value is "false" then the booking will be visible to all users.
- repeatJSONObject, optional
- The repeat JSON can be given if you want to add a recurring booking.
- The parameters marked mandatory should be given only when you add the RepeatJson to your request URL.
- RepeatJson:
- freqstring, mandatory
- The freq parameter denotes the repeat frequency of the booking.
- Allowed values: daily | weekly | monthly
- intervalint, mandatory
- The interval parameter is a number that represent the repeat interval in which the booking is being done.
- untilstring, mandatory
- The until parameter is the date until which the booking recurs.
- The format for the date value is iso8601basic (yyyMMdd).
- Example: 20220127
- bydaystring, optional
- The byday parameter can be given for the bookings that recur on particular days in a weekly recurring bookings.
- The values that can be given are:
- Sunday - Su
- Monday - Mo
- Tuesday - Tu
- Wednesday - We
- Thursday - Th
- Friday - Fr
- Saturday - Sa
- βThe byday parameter can also be given when you create recurring bookings that repeat on a Monthly basis and you want the booking to occur on a particular day of the month say 1st Saturday or 2nd Monday or 3rd Wednesday and so on.
- Example: byday="1Sa", byday="2Mo".
- bymonthdaystring, optional
- The bymonthday parameter denotes the day of the month on which the booking should recur.
- Example: If you want a booking to recur every month on day 3 of each month, then the parameter value should be given as bymonthday="3".
- resourcesJSONArray, mandatory
- The resources JSONArray is required to book a resource. The key parameter values are provided as BookResJson.
- BookResJson:
- resource_idlong, mandatory
- The resource_id can be fetched using the Get resources API or from the response of Add resource API.
- countint, optional
- The number of resource requirement needs to be given as the value.
- typeint, mandatory
- The type of resource that we support now is Rooms only.
- The value for type="0" denotes the rooms in resource booking.
- attendeesJSONArray, optional
- The RBAttendeeJson will have the values of the email id of the attendees, their user id, and the type of permission given to them as a JSONArray.
- RBAttendeeJson:
- emailstring, mandatory
- The email parameter will have the email ids of the attendees as values.
- zidlong, mandatory
- The zid can be fetched by the org admin using the user email id. The zids should be used along with the email while creating a request to book a resource.
- permissionint, mandatory
- The permission value shall be assigned as 0 or 1 or 2 or 3
- 0 - The attendees can only view the details of the booking but not the participant list.
- 1 - The attendees can view the details of the booking and participant list but cannot edit the booking.
- 2 - The attendees can add participants to the booking but cannot edit other booking details.
- 3 - The attendees can edit the complete event.
- group_attendeesJSONArray, optional
- The group attendees JSON will have the values of group id and the type of permission given.
- GrpAttendeeJson:
- zidlong, mandatory
- The zid can be fetched by the org admin using the group email id.
- permissionint, optional
- The permission value shall be assigned as 0 or 1 or 2 or 3
- 0 - The attendees can only view the details of the booking but not the participant list.
- 1 - The attendees can view the details of the booking and participant list but cannot edit the booking.
- 2 - The attendees can add participants to the booking but cannot edit other booking details.
- 3 - The attendees can edit the complete event.
- notify_attendeeint, optional
- The notify attendee parameter is given to send notifications to the attendees added to a booking.
- The values for the parameter can be given as follows:
- notify_attendee=0 - Send notification to None.
- notify_attendee=1 - Send notification to all attendees excluding me.
- notify_attendee=2 - Send notification to all attendees including me.
- descriptionstring, optional
- A description can be given for each booking you create.
Sample Request
Copiedhttps://calendar.zoho.com/api/v1/bookings?bookingData={"title":"Booking","description":"Attendee booking","isprivate":false,"dateandtime":{"start":"20211119T010000","end":"20211119T013000","timezone":"Asia/Kolkata"},"resources":[{"resource_id":"1605702686149000001","type":0}],"attendees":[{"email":"cal2@m43.com","zid":"61130357"},{"email":"cal3@m43.com","zid":"61130359"}],"group_attendees":[{"zid":"61178943","permission":1}],"notify_attendee":1}Sample Response
Copied{
"20211119":
{
"end_date":"20211119",
"role":"organizer",
"group_attendees":[
{
"zid":61178943,
"permission":1,
"type":1,
"notify_status":1,
"email":"v386"
}
],
"timezone":"Asia/Kolkata",
"description":"Attendee booking",
"title":"Booking",
"booking_id":"1637245399406000001",
"bookedby_email":"cal1@m43.com",
"uid":"ZRB_0e4d7d8f9fa04cadbe5001dd0c721c2b@zoho.com",
"booked_by":"61130355",
"is_own_booking":true,
"all_day":false,
"end":1637265600000,
"dateandtime":
{
"timezone":"Asia/Kolkata",
"start":"20211119T010000",
"end":"20211119T013000"
},
"start_date":"20211119",
"isprivate":false,
"is_member":true,
"is_repeat":false,
"attendees":[
{
"zid":61130357,
"permission":1,
"type":0,
"notify_status":1,
"email":"cal2@m43.com"
},
{
"zid":61130359,
"permission":1,
"type":0,
"notify_status":1,
"email":"cal3@m43.com"
}
],
"end_time":"0130",
"start":1637263800000,
"resources":[
{
"count":0,
"resource_id":"1605702686149000001",
"type":0
}
],
"created_by":"61130355",
"users":[
{
"zid":61130355,
"type":0,
"email":"cal1@m43.com"
},
{
"zid":61130357,
"permission":1,
"type":0,
"notify_status":1,
"email":"cal2@m43.com"
},
{
"zid":61130359,
"permission":1,
"type":0,
"notify_status":1,
"email":"cal3@m43.com"
}
],
"start_time":"0100",
"is_rel_event":false,
"booking_approved":true,
"desc":"Attendee booking"
},
"booking_count_json":
{
"20211119_20211119_1605702686149000001":1
},
"start_date":"20211119"
}Error message: If the resource is not available for the selected time slot
Copied{
"error_message":"Resource is not available for the selected time slot",
"errorcode":"RESOURCE_NOT_AVAILABLE_FOR_BOOKING",
"status":"failure"
}Error message: If the booking range exceeds the default maximum months for bookings.
Copied{
"error_message":"Booking range cannot exceed 3 months",
"errorcode":"BOOKING_RANGE_CANNOT_EXCEED_CONFIGURED_MONTHS",
"status":"failure"
}