This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Freebusy in Google Calendar
Overview
The following operations allow you to work with freebusy. Click an operation name to see details on how to use it.
Operation | Description |
---|---|
getFreebusy | Returns free or busy information. |
For a sample proxy service that illustrates how to work with freebusy, see Sample configuration .
Operation details
Following is more information about each of the operations.
Returning free/busy information
To return free or busy information for a set of calendars, use googlecalendar.getFreebusy
and specify the relevant properties.
<googlecalendar.getFreebusy> <timeMin>{$ctx:timeMin}</timeMin> <items>{$ctx:items}</items> <timeZone>{$ctx:timeZone}</timeZone> <groupExpansionMax>{$ctx:groupExpansionMax}</groupExpansionMax> <timeMax>{$ctx:timeMax}</timeMax> <calendarExpansionMax>{$ctx:calendarExpansionMax}</calendarExpansionMax> <fields>{$ctx:fields}</fields> </googlecalendar.getFreebusy>Â
Properties
timeMin:
The start of the interval for the query.items[]:
 The list of calendars and groups to query.timeZone:
Optional - The time zone used in the response. The default value is UTC.groupExpansionMax:
Optional - The maximum number of calendar identifiers to be provided for a single group.. An error will be returned for a group with more members than this value.timeMax:
The end of the interval for the query.calendarExpansionMax:
Optional - The maximum number of calendars for which FreeBusy information is to be provided.fields:
Selector specifying which fields to include in a partial response.
Sample request
Following is a sample REST request that can be handled by the getFreebusy
 operation.
 { "apiUrl": "https://www.googleapis.com", "accessToken": "ya29.1.AADtN_WLQOd1YIA6_QG1Lx2_3OYwz6optER2VvpFzD6U5qerwh6K4KKf8EDx0e63LcudOUIk", "timeMin": "2014-03-15T03:30:00+05:30", "timeMax": "2014-03-18T03:30:00+05:30", "items": [ { "id": "wso2connector.abdera@gmail.com" } ], "timeZone": "Asia/Colombo", "groupExpansionMax": 1, "calendarExpansionMax": 1 }
Following is more information about the items
parameters in the sample request:
items
id:
The identifier of a calendar or a group.
Related Google Calendar documentation
https://developers.google.com/google-apps/calendar/v3/reference/freebusy/query
Sample configuration
Following is a sample proxy service that illustrates how to connect to Google Calendar with the init
 operation as well as how to use the getFreebusy
 operation.
To view the sample request for this proxy, see sample request for the getFreebusy operation. You can use this sample as a template for using other operations in this category.
As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is faultHandlerSeq
.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="googlecalendar_getFreebusy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="fields" expression="json-eval($.fields)"/> <property name="timeMin" expression="json-eval($.timeMin)"/> <property name="timeMax" expression="json-eval($.timeMax)"/> <property name="timeZone" expression="json-eval($.timeZone)"/> <property name="groupExpansionMax" expression="json-eval($.groupExpansionMax)"/> <property name="calendarExpansionMax" expression="json-eval($.calendarExpansionMax)"/> <property name="items" expression="json-eval($.items)"/> <googlecalendar.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> </googlecalendar.init> <googlecalendar.getFreebusy> <timeMin>{$ctx:timeMin}</timeMin> <items>{$ctx:items}</items> <timeZone>{$ctx:timeZone}</timeZone> <groupExpansionMax>{$ctx:groupExpansionMax}</groupExpansionMax> <timeMax>{$ctx:timeMax}</timeMax> <calendarExpansionMax>{$ctx:calendarExpansionMax}</calendarExpansionMax> <fields>{$ctx:fields}</fields> </googlecalendar.getFreebusy> <respond></respond> </inSequence> <outSequence> <send></send> </outSequence> <faultSequence> <property name="ERROR_CODE" value="600500"/> <property name="ERROR_MESSAGE" value="Internal Server Error"/> <property name="messageType" value="application/json" scope="axis2"/> <sequence key="faultHandlerSeq"/> </faultSequence> </target> </proxy>