Google Calendar
Since Camel 2.15
Both producer and consumer are supported
The Google Calendar component provides access to Google Calendar via the Google Calendar Web APIs.
Google Calendar uses the OAuth 2.0 protocol for authenticating a Google account and authorizing access to user data. Before you can use this component, you will need to create an account and generate OAuth credentials. Credentials consist of a clientId, clientSecret, and a refreshToken. A handy resource for generating a long-lived refreshToken is the OAuth playground.
In the case of a service account, credentials consist of a JSON-file (serviceAccountKey). You can also use delegation domain-wide authority (delegate) and one, several, or all possible Calendar API Auth Scopes.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-google-calendar</artifactId>
<!-- use the same version as your Camel core version -->
<version>x.x.x</version>
</dependency> Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Google Calendar component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The name of the application, sent in the User-Agent header of the requests, for example camel-google-calendar/1.0. | String | ||
The client ID of the OAuth 2.0 application. | String | ||
Shared configuration, whose options are the defaults of every endpoint of this component. | GoogleCalendarConfiguration | ||
The email address of the user to impersonate with the domain-wide delegation of the service account. | String | ||
The OAuth 2.0 scopes, which set the permissions of the application on the user account, separated by comma. See https://developers.google.com/identity/protocols/googlescopes. | String | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
The factory that creates the Google Calendar client of each endpoint. The default is BatchGoogleCalendarClientFactory. | GoogleCalendarClientFactory | ||
The OAuth 2.0 access token. It typically expires after an hour, so set refreshToken for long-term use. | String | ||
The client secret of the OAuth 2.0 application. | String | ||
The email address of the Google service account. | String | ||
The path of the P12 file with the private key of the Google service account. | String | ||
The OAuth 2.0 refresh token, with which the component obtains a new access token whenever the current one expires. A long-lived application needs it. | String | ||
The service account key in JSON format, to authenticate the application as a service account. Accepts base64 with the prefix base64:. | String | ||
The email address of the user to impersonate in the service account flow. | String |
Endpoint Options
The Google Calendar endpoint is configured using URI syntax:
google-calendar:apiName/methodName
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The API to use, such as events or calendars. The list API is the calendar list of the user. Enum values:
| GoogleCalendarApiName | ||
Required The method of the API to call, such as insert or list. Enum values:
| String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The name of the application, sent in the User-Agent header of the requests, for example camel-google-calendar/1.0. | String | ||
The client ID of the OAuth 2.0 application. | String | ||
The email address of the user to impersonate with the domain-wide delegation of the service account. | String | ||
Sets the name of a parameter to be passed in the exchange In Body. | String | ||
The OAuth 2.0 scopes, which set the permissions of the application on the user account, separated by comma. See https://developers.google.com/identity/protocols/googlescopes. | String | ||
If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | PollingConsumerPollStrategy | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | int | ||
The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | int | ||
To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | int | ||
Milliseconds before the next poll. | 500 | long | |
If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean | |
How long a poll may run before the health check of the consumer reports DOWN. The health check is otherwise based on the polls that are done, so it stays UP while a poll hangs, for example on a read without timeout from a connection that went silent. A poll includes routing the messages it polled, so set this above the longest poll you expect. The poll is not interrupted. The value is in millis (not affected by timeUnit). The default 0 turns this off. | 0 | long | |
Milliseconds before the first poll starts. | 1000 | long | |
Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. | 0 | long | |
The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. Enum values:
| TRACE | LoggingLevel | |
Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | ScheduledExecutorService | ||
To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler. | none | Object | |
To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. This is a multi-value option with prefix: scheduler. | Map | ||
Whether the scheduler should be auto started. | true | boolean | |
Time unit for initialDelay and delay options. Enum values:
| MILLISECONDS | TimeUnit | |
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean | |
The OAuth 2.0 access token. It typically expires after an hour, so set refreshToken for long-term use. | String | ||
The client secret of the OAuth 2.0 application. | String | ||
The email address of the Google service account. | String | ||
The path of the P12 file with the private key of the Google service account. | String | ||
The OAuth 2.0 refresh token, with which the component obtains a new access token whenever the current one expires. A long-lived application needs it. | String | ||
The service account key in JSON format, to authenticate the application as a service account. Accepts base64 with the prefix base64:. | String | ||
The email address of the user to impersonate in the service account flow. | String |
API Parameters (7 APIs)
The Google Calendar endpoint is an API-based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName path parameters:
google-calendar:apiName/methodName
There are 7 API names as listed in the table below:
| API Name | Type | Description |
|---|---|---|
Both | The acl collection of methods | |
Both | The calendars collection of methods | |
Both | The channels collection of methods | |
Both | The events collection of methods | |
Both | The freebusy collection of methods | |
Both | The calendarList collection of methods | |
Both | The settings collection of methods |
Each API is documented in the following sections to come.
API: acl
Both producer and consumer are supported
The acl API is defined in the syntax as follows:
google-calendar:acl/methodName?[parameters] The 7 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Deletes an access control rule | ||
Returns an access control rule | ||
Creates an access control rule | ||
Returns the rules in the access control list for the calendar | ||
Updates the given fields of an access control rule (patch semantics) | ||
Replaces an access control rule | ||
Watches the access control rules of a calendar for changes; Google sends push notifications to the address of the channel |
Method delete
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.Delete delete(String calendarId, String ruleId);
The google-calendar/delete API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
ruleId | ACL rule identifier | String |
Method get
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.Get get(String calendarId, String ruleId);
The google-calendar/get API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
ruleId | ACL rule identifier | String |
Method insert
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.Insert insert(String calendarId, com.google.api.services.calendar.model.AclRule content);
The google-calendar/insert API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
content | The access control rule to create, with the role and the scope | AclRule |
sendNotifications | Whether to send notifications about the change of the calendar sharing, true by default | Boolean |
Method list
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.List list(String calendarId);
The google-calendar/list API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
maxResults | The maximum number of entries on one result page, 100 by default and at most 250 | Integer |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
showDeleted | Whether to include deleted ACLs in the result | Boolean |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
Method patch
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.Patch patch(String calendarId, String ruleId, com.google.api.services.calendar.model.AclRule content);
The google-calendar/patch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
content | The fields of the access control rule to change; the fields that are not set are left as they are | AclRule |
ruleId | ACL rule identifier | String |
sendNotifications | Whether to send notifications about the change of the calendar sharing, true by default | Boolean |
Method update
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.Update update(String calendarId, String ruleId, com.google.api.services.calendar.model.AclRule content);
The google-calendar/update API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
content | The access control rule that replaces the existing one | AclRule |
ruleId | ACL rule identifier | String |
sendNotifications | Whether to send notifications about the change of the calendar sharing, true by default | Boolean |
Method watch
Signatures:
-
com.google.api.services.calendar.Calendar.Acl.Watch watch(String calendarId, com.google.api.services.calendar.model.Channel contentChannel);
The google-calendar/watch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
contentChannel | The notification channel to open: a unique id, the type web_hook and the HTTPS address that receives the notifications | Channel |
maxResults | The maximum number of entries on one result page, 100 by default and at most 250 | Integer |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
showDeleted | Whether to include deleted ACLs in the result | Boolean |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
API: calendars
Both producer and consumer are supported
The calendars API is defined in the syntax as follows:
google-calendar:calendars/methodName?[parameters] The 6 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Deletes all the events of a primary calendar | ||
Deletes a secondary calendar | ||
Returns metadata for a calendar | ||
Creates a secondary calendar | ||
Updates the given fields of the metadata of a calendar (patch semantics) | ||
Replaces the metadata of a calendar |
Method clear
Signatures:
-
com.google.api.services.calendar.Calendar.Calendars.Clear clear(String calendarId);
The google-calendar/clear API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
Method delete
Signatures:
-
com.google.api.services.calendar.Calendar.Calendars.Delete delete(String calendarId);
The google-calendar/delete API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
Method get
Signatures:
-
com.google.api.services.calendar.Calendar.Calendars.Get get(String calendarId);
The google-calendar/get API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
Method insert
Signatures:
-
com.google.api.services.calendar.Calendar.Calendars.Insert insert(com.google.api.services.calendar.model.Calendar content);
The google-calendar/insert API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
content | The secondary calendar to create, with at least the summary; the authenticated user becomes its owner | Calendar |
Method patch
Signatures:
-
com.google.api.services.calendar.Calendar.Calendars.Patch patch(String calendarId, com.google.api.services.calendar.model.Calendar content);
The google-calendar/patch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
content | The fields of the calendar metadata to change; the fields that are not set are left as they are | Calendar |
Method update
Signatures:
-
com.google.api.services.calendar.Calendar.Calendars.Update update(String calendarId, com.google.api.services.calendar.model.Calendar content);
The google-calendar/update API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
content | The calendar metadata that replaces the existing metadata | Calendar |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
API: channels
Both producer and consumer are supported
The channels API is defined in the syntax as follows:
google-calendar:channels/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Stops the push notifications of a channel opened by a watch method |
Method stop
Signatures:
-
com.google.api.services.calendar.Calendar.Channels.Stop stop(com.google.api.services.calendar.model.Channel contentChannel);
The google-calendar/stop API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
contentChannel | The channel to stop, with the id and the resourceId that the watch method returned | Channel |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
API: events
Both producer and consumer are supported
The events API is defined in the syntax as follows:
google-calendar:events/methodName?[parameters] The 11 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Imports a private copy of an existing event into a calendar (events.import of the Calendar API); only events of type default can be imported | ||
Deletes an event | ||
Returns an event based on its Google Calendar ID | ||
Creates an event | ||
Returns instances of the specified recurring event | ||
Returns events on the specified calendar | ||
Moves an event to another calendar, which changes the organizer of the event; only events of type default can be moved | ||
Updates the given fields of an event (patch semantics) | ||
Creates an event based on a simple text string | ||
Replaces an event | ||
Watches the events of a calendar for changes; Google sends push notifications to the address of the channel |
Method calendarImport
Signatures:
-
com.google.api.services.calendar.Calendar.Events.CalendarImport calendarImport(String calendarId, com.google.api.services.calendar.model.Event content);
The google-calendar/calendarImport API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
conferenceDataVersion | The version of conference data that the client supports: 0 (the default) ignores the conference data of the event, 1 supports copying and creating conferences | Integer |
content | The event to import, with the iCalUID of the existing event | Event |
supportsAttachments | Whether the client supports event attachments, false by default; must be true to add or change the attachments of an event | Boolean |
Method delete
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Delete delete(String calendarId, String eventId);
The google-calendar/delete API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
eventId | Event identifier | String |
sendNotifications | Deprecated, use sendUpdates instead: whether to send notifications to the guests of the event, false by default | Boolean |
sendUpdates | The guests who receive notifications about the change of the event: all, externalOnly (only the guests who do not use Google Calendar) or none | String |
Method get
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Get get(String calendarId, String eventId);
The google-calendar/get API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
alwaysIncludeEmail | Deprecated and ignored by Google Calendar: the email field of the organizer, creator and attendees is always returned | Boolean |
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
eventId | Event identifier | String |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
timeZone | The time zone used in the response, by default the time zone of the calendar | String |
Method insert
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Insert insert(String calendarId, com.google.api.services.calendar.model.Event content);
The google-calendar/insert API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
conferenceDataVersion | The version of conference data that the client supports: 0 (the default) ignores the conference data of the event, 1 supports copying and creating conferences | Integer |
content | The event to create, with at least the start and the end | Event |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
sendNotifications | Deprecated, use sendUpdates instead: whether to send notifications to the guests of the event, false by default | Boolean |
sendUpdates | The guests who receive notifications about the change of the event: all, externalOnly (only the guests who do not use Google Calendar) or none | String |
supportsAttachments | Whether the client supports event attachments, false by default; must be true to add or change the attachments of an event | Boolean |
Method instances
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Instances instances(String calendarId, String eventId);
The google-calendar/instances API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
alwaysIncludeEmail | Deprecated and ignored by Google Calendar: the email field of the organizer, creator and attendees is always returned | Boolean |
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
eventId | Recurring event identifier | String |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
maxResults | The maximum number of events on one result page, 250 by default and at most 2500 | Integer |
originalStart | The original start time of the instance in the result | String |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
showDeleted | Whether to include deleted events (with status equals cancelled) in the result | Boolean |
timeMax | Upper bound (exclusive) for an event’s start time to filter by | DateTime |
timeMin | Lower bound (inclusive) for an event’s end time to filter by | DateTime |
timeZone | The time zone used in the response, by default the time zone of the calendar | String |
Method list
Signatures:
-
com.google.api.services.calendar.Calendar.Events.List list(String calendarId);
The google-calendar/list API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
alwaysIncludeEmail | Deprecated and ignored by Google Calendar: the email field of the organizer, creator and attendees is always returned | Boolean |
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
eventTypes | The event types to return: birthday, default, focusTime, fromGmail, outOfOffice or workingLocation; all types when not set | List |
iCalUID | The event ID in the iCalendar format (iCalUID) of the event to find | String |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
maxResults | The maximum number of events on one result page, 250 by default and at most 2500 | Integer |
orderBy | The order of the events in the result: startTime (only with singleEvents set to true) or updated; an unspecified, stable order when not set | String |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
privateExtendedProperty | Extended property constraints as propertyName=value that match only private properties; an event must match all of them | List |
q | Free text search terms to find the events that match them in the summary, description, location, attendees, organizer and working location | String |
sharedExtendedProperty | Extended property constraints as propertyName=value that match only shared properties; an event must match all of them | List |
showDeleted | Whether to include deleted events (with status equals cancelled) in the result | Boolean |
showHiddenInvitations | Whether to include hidden invitations in the result | Boolean |
singleEvents | Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves | Boolean |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
timeMax | Upper bound (exclusive) for an event’s start time to filter by | DateTime |
timeMin | Lower bound (exclusive) for an event’s end time to filter by | DateTime |
timeZone | The time zone used in the response, by default the time zone of the calendar | String |
updatedMin | Lower bound for an event’s last modification time (as a RFC3339 timestamp) to filter by | DateTime |
Method move
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Move move(String calendarId, String eventId, String destination);
The google-calendar/move API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar that the event is on now | String |
destination | Calendar identifier of the target calendar where the event is to be moved to | String |
eventId | Event identifier | String |
sendNotifications | Deprecated, use sendUpdates instead: whether to send notifications to the guests of the event, false by default | Boolean |
sendUpdates | The guests who receive notifications about the change of the event: all, externalOnly (only the guests who do not use Google Calendar) or none | String |
Method patch
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Patch patch(String calendarId, String eventId, com.google.api.services.calendar.model.Event content);
The google-calendar/patch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
alwaysIncludeEmail | Deprecated and ignored by Google Calendar: the email field of the organizer, creator and attendees is always returned | Boolean |
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
conferenceDataVersion | The version of conference data that the client supports: 0 (the default) ignores the conference data of the event, 1 supports copying and creating conferences | Integer |
content | The fields of the event to change; the fields that are not set are left as they are | Event |
eventId | Event identifier | String |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
sendNotifications | Deprecated, use sendUpdates instead: whether to send notifications to the guests of the event, false by default | Boolean |
sendUpdates | The guests who receive notifications about the change of the event: all, externalOnly (only the guests who do not use Google Calendar) or none | String |
supportsAttachments | Whether the client supports event attachments, false by default; must be true to add or change the attachments of an event | Boolean |
Method quickAdd
Signatures:
-
com.google.api.services.calendar.Calendar.Events.QuickAdd quickAdd(String calendarId, String text);
The google-calendar/quickAdd API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
sendNotifications | Deprecated, use sendUpdates instead: whether to send notifications to the guests of the event, false by default | Boolean |
sendUpdates | The guests who receive notifications about the change of the event: all, externalOnly (only the guests who do not use Google Calendar) or none | String |
text | The text describing the event to be created | String |
Method update
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Update update(String calendarId, String eventId, com.google.api.services.calendar.model.Event content);
The google-calendar/update API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
alwaysIncludeEmail | Deprecated and ignored by Google Calendar: the email field of the organizer, creator and attendees is always returned | Boolean |
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
conferenceDataVersion | The version of conference data that the client supports: 0 (the default) ignores the conference data of the event, 1 supports copying and creating conferences | Integer |
content | The event that replaces the existing event; the fields that are not set are cleared | Event |
eventId | Event identifier | String |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
sendNotifications | Deprecated, use sendUpdates instead: whether to send notifications to the guests of the event, false by default | Boolean |
sendUpdates | The guests who receive notifications about the change of the event: all, externalOnly (only the guests who do not use Google Calendar) or none | String |
supportsAttachments | Whether the client supports event attachments, false by default; must be true to add or change the attachments of an event | Boolean |
Method watch
Signatures:
-
com.google.api.services.calendar.Calendar.Events.Watch watch(String calendarId, com.google.api.services.calendar.model.Channel contentChannel);
The google-calendar/watch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
alwaysIncludeEmail | Deprecated and ignored by Google Calendar: the email field of the organizer, creator and attendees is always returned | Boolean |
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
contentChannel | The notification channel to open: a unique id, the type web_hook and the HTTPS address that receives the notifications | Channel |
eventTypes | The event types to return: birthday, default, focusTime, fromGmail, outOfOffice or workingLocation; all types when not set | List |
iCalUID | The event ID in the iCalendar format (iCalUID) of the event to find | String |
maxAttendees | The maximum number of attendees to include in the response; when the event has more, only the authenticated user is returned as attendee | Integer |
maxResults | The maximum number of events on one result page, 250 by default and at most 2500 | Integer |
orderBy | The order of the events in the result: startTime (only with singleEvents set to true) or updated; an unspecified, stable order when not set | String |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
privateExtendedProperty | Extended property constraints as propertyName=value that match only private properties; an event must match all of them | List |
q | Free text search terms to find the events that match them in the summary, description, location, attendees, organizer and working location | String |
sharedExtendedProperty | Extended property constraints as propertyName=value that match only shared properties; an event must match all of them | List |
showDeleted | Whether to include deleted events (with status equals cancelled) in the result | Boolean |
showHiddenInvitations | Whether to include hidden invitations in the result | Boolean |
singleEvents | Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves | Boolean |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
timeMax | Upper bound (exclusive) for an event’s start time to filter by | DateTime |
timeMin | Lower bound (exclusive) for an event’s end time to filter by | DateTime |
timeZone | The time zone used in the response, by default the time zone of the calendar | String |
updatedMin | Lower bound for an event’s last modification time (as a RFC3339 timestamp) to filter by | DateTime |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
API: freebusy
Both producer and consumer are supported
The freebusy API is defined in the syntax as follows:
google-calendar:freebusy/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Returns free/busy information for a set of calendars |
Method query
Signatures:
-
com.google.api.services.calendar.Calendar.Freebusy.Query query(com.google.api.services.calendar.model.FreeBusyRequest content);
The google-calendar/query API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
content | The query, with the time range (timeMin, timeMax) and the calendars (items) to get the free/busy information of | FreeBusyRequest |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
API: list
Both producer and consumer are supported
The list API is defined in the syntax as follows:
google-calendar:list/methodName?[parameters] The 7 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Removes a calendar from the user’s calendar list | ||
Returns a calendar from the user’s calendar list | ||
Inserts an existing calendar into the user’s calendar list | ||
Returns the calendars on the user’s calendar list | ||
Updates the given fields of a calendar on the user’s calendar list (patch semantics) | ||
Replaces the entry of a calendar on the user’s calendar list | ||
Watches the user’s calendar list for changes; Google sends push notifications to the address of the channel |
Method delete
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.Delete delete(String calendarId);
The google-calendar/delete API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
Method get
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.Get get(String calendarId);
The google-calendar/get API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
Method insert
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.Insert insert(com.google.api.services.calendar.model.CalendarListEntry content);
The google-calendar/insert API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
colorRgbFormat | Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB) | Boolean |
content | The calendar list entry to add, with the id of an existing calendar | CalendarListEntry |
Method list
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.List list();
The google-calendar/list API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
maxResults | The maximum number of entries on one result page, 100 by default and at most 250 | Integer |
minAccessRole | The minimum access role of the user in the returned entries: freeBusyReader, reader, writer or owner; no restriction when not set | String |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
showDeleted | Whether to include deleted calendar list entries in the result | Boolean |
showHidden | Whether to show hidden entries | Boolean |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
Method patch
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.Patch patch(String calendarId, com.google.api.services.calendar.model.CalendarListEntry content);
The google-calendar/patch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
colorRgbFormat | Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB) | Boolean |
content | The fields of the calendar list entry to change; the fields that are not set are left as they are | CalendarListEntry |
Method update
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.Update update(String calendarId, com.google.api.services.calendar.model.CalendarListEntry content);
The google-calendar/update API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
calendarId | The ID of the calendar, as returned by the list/list method, or primary for the primary calendar of the authenticated user | String |
colorRgbFormat | Whether to use the foregroundColor and backgroundColor fields to write the calendar colors (RGB) | Boolean |
content | The calendar list entry that replaces the existing entry | CalendarListEntry |
Method watch
Signatures:
-
com.google.api.services.calendar.Calendar.CalendarList.Watch watch(com.google.api.services.calendar.model.Channel contentChannel);
The google-calendar/watch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
contentChannel | The notification channel to open: a unique id, the type web_hook and the HTTPS address that receives the notifications | Channel |
maxResults | The maximum number of entries on one result page, 100 by default and at most 250 | Integer |
minAccessRole | The minimum access role of the user in the returned entries: freeBusyReader, reader, writer or owner; no restriction when not set | String |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
showDeleted | Whether to include deleted calendar list entries in the result | Boolean |
showHidden | Whether to show hidden entries | Boolean |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
API: settings
Both producer and consumer are supported
The settings API is defined in the syntax as follows:
google-calendar:settings/methodName?[parameters] The 3 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Returns a single user setting | ||
Returns all user settings for the authenticated user | ||
Watches the settings of the authenticated user for changes; Google sends push notifications to the address of the channel |
Method get
Signatures:
-
com.google.api.services.calendar.Calendar.Settings.Get get(String setting);
The google-calendar/get API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
setting | The id of the user setting | String |
Method list
Signatures:
-
com.google.api.services.calendar.Calendar.Settings.List list();
The google-calendar/list API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
maxResults | The maximum number of entries on one result page, 100 by default and at most 250 | Integer |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
Method watch
Signatures:
-
com.google.api.services.calendar.Calendar.Settings.Watch watch(com.google.api.services.calendar.model.Channel contentChannel);
The google-calendar/watch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
contentChannel | The notification channel to open: a unique id, the type web_hook and the HTTPS address that receives the notifications | Channel |
maxResults | The maximum number of entries on one result page, 100 by default and at most 250 | Integer |
pageToken | The token of the result page to return, the nextPageToken of the previous page; each call returns one page | String |
syncToken | The nextSyncToken of the last result page of a previous list request, to get only the entries that changed since then; the server answers 410 GONE when the token has expired | String |
In addition to the parameters above, the google-calendar API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelGoogleCalendar.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelGoogleCalendar.myParameterNameHere header.
Message Headers
The Google Calendar component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelGoogleCalendar. (producer) Constant: | The prefix of the headers that carry the parameters of the API method: the header CamelGoogleCalendar.calendarId holds the calendarId parameter. The name without the dot, such as CamelGoogleCalendarCalendarId, works too. | Object |
Message Body
The message body at each side of the Google Calendar component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| One message per poll with the return value of the method: a Google Calendar model object, such as the Events of events/list, which is one message and not split per event. The model classes are GenericJson, which is also a Map of the JSON fields. |
Producer input |
| The body is used only when inBody names a parameter of the method, and must then be of the type of that parameter: an Event for content of events/insert, or text for text of events/quickAdd. JSON text or a Map is not turned into a model object: build it first. Without inBody the arguments come from the options and the CamelGoogleCalendar. headers. Not known when |
Producer output |
| The return value of the method: a Google Calendar model object, such as the Event of events/insert and events/get or the Events of events/list; null for the methods without a response: events/delete, acl/delete, calendars/clear, calendars/delete, list/delete and channels/stop. The model classes are GenericJson, which is also a Map of the JSON fields. |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
| This is an API-based component, so per-call parameters can be supplied through |
Usage
The endpoint is the API name and the method name, such as events/quickAdd. The parameters of the method are endpoint options or headers with the CamelGoogleCalendar. prefix, and inBody names the parameter that comes from the message body. The following route adds an event to the primary calendar from a text in the message body, such as Lunch with the team tomorrow at noon:
- route:
from:
uri: direct:addEvent
steps:
- to:
uri: google-calendar:events/quickAdd
parameters:
calendarId: primary
inBody: text
clientId: "{{google.clientId}}"
clientSecret: "{{google.clientSecret}}"
refreshToken: "{{google.refreshToken}}"
applicationName: camel-example
- log:
message: "Created event ${body.htmlLink}"