> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateSyncConfig # Package: calendar # Namespace: ExternalCalendarService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/calendar/external-calendar-v2/update-sync-config.md ## Permission Scopes: Manage External Calendars: SCOPE.DC-BOOKINGS.MANAGE-EXTERNAL-CALENDARS ## Introduction Updates the import and export settings for an external calendar connection's events. A connection's `syncConfig` object determines: + Whether events from 1 or more accounts belonging to the external calendar are imported to the connected [Wix schedule](https://dev.wix.com/docs/api-reference/business-management/calendar/schedules-v3/introduction.md). If importing events is enabled, you can call [List Events](https://dev.wix.com/docs/api-reference/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to retrieve external calendar events. + Whether events from the Wix schedule are exported to 1 or more accounts belonging to the external calendar. To check the current import and export settings, you can call [Get Connection](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/get-connection.md) or [List Connections](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-connections.md). --- ## REST API ### Schema ``` Method: updateSyncConfig Description: Updates the import and export settings for an external calendar connection's events. A connection's `syncConfig` object determines: + Whether events from 1 or more accounts belonging to the external calendar are imported to the connected [Wix schedule](https://dev.wix.com/docs/api-reference/business-management/calendar/schedules-v3/introduction.md). If importing events is enabled, you can call [List Events](https://dev.wix.com/docs/api-reference/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to retrieve external calendar events. + Whether events from the Wix schedule are exported to 1 or more accounts belonging to the external calendar. To check the current import and export settings, you can call [Get Connection](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/get-connection.md) or [List Connections](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-connections.md). URL: https://www.wixapis.com/bookings/v2/external-calendars/connections/{connectionId}/sync-config Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: syncConfig Method parameters: param name: syncConfig | type: ConnectionSyncConfig | required: true - name: listEventFromCalendars | type: ListEventFromCalendars | description: Configuration for importing events from the external calendar to the Wix site. - ONE-OF: - name: primaryCalendar | type: PrimaryCalendar | description: An empty `primaryCalendar` object indicates that you can import events only from the primary external calendar. Keep in mind that not all external calendar providers support primary calendars. EMPTY-OBJECT {} - name: calendars | type: Calendars | description: You can import events from the list of specified external calendar accounts. The list may include the primary calendar. - name: calendars | type: array | description: - name: name | type: string | description: Display name of the external calendar account. For example, `Primary` or `Birthdays`. - name: enabled | type: boolean | description: Whether you can call [List Events](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to import events from the external calendar to the Wix site. - name: syncToCalendar | type: SyncToCalendar | description: Configuration for exporting events from the Wix site to the external calendar. - ONE-OF: - name: primaryCalendar | type: PrimaryCalendar | description: An empty `primaryCalendar` object indicates that Wix events are exported only to the primary account of the external calendar. - name: dedicatedCalendar | type: DedicatedCalendar | description: An empty `dedicatedCalendar` object indicates that Wix events are exported only to the dedicated account of the external calendar. EMPTY-OBJECT {} - name: enabled | type: boolean | description: Whether Wix [events](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction.md) are exported to the external calendar. Return type: UpdateSyncConfigResponse - name: connection | type: Connection | description: Connection with updated sync configuration. - name: id | type: string | description: GUID of the connection between the external calendar and the Wix site. - name: providerId | type: string | description: GUID of the external calendar provider. - name: calendarType | type: CalendarType | description: External calendar type. - enum: - UNDEFINED: There is no information about the external calendar type. - GOOGLE: [Google Calendar](https://developers.google.com/calendar/api/guides/overview). - I_CAL: Apple iCalendar. - OUTLOOK: __Deprecated__. Use `MICROSOFT` instead. - OFFICE_365: __Deprecated__. Use `MICROSOFT` instead. - MICROSOFT: Microsoft Calendar. For example, Office 365 calendar or Outlook calendar. - OTHER: A different type of external calendar, not listed here. - name: scheduleId | type: string | description: GUID of the [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md) that's connected to the external calendar. - name: userId | type: string | description: GUID of the [Wix user](https://dev.wix.com/docs/rest/articles/getting-started/about-identities.md#wix-user) to whom the external calendar connection belongs. - name: appId | type: string | description: GUID of the app which created the external calendar connection. - name: externalAccountEmail | type: string | description: Email address associated with the external calendar account. Available only after completed successfully. - name: status | type: Status | description: Connection status. - enum: - UNDEFINED: There is no information about the connection status. - CONNECTED: The external calendar is connected to the Wix [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md), but the sync process hasn't started yet. - SYNC_IN_PROGRESS: Sync process is ongoing. - SYNCED: The Wix calendar and the external calendar are in sync. - DISCONNECTED: The external calender has been disconnected from the Wix [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md). - ERROR: The calendars sync is in error state. - name: errorReason | type: ErrorReason | description: Reason for the error. Available only if `status` is `ERROR`. - enum: - UNDEFINED: There is no information about the connection error. - TOKEN_REVOKED: The external calendar's access token has been revoked. - EXTERNAL_CALENDAR_CREATION_FAILED: The external calendar couldn't be created. - EXTERNAL_CALENDAR_DELETED: The external calendar was deleted. - name: syncConfig | type: ConnectionSyncConfig | description: Settings about which sync operations are supported. - name: listEventFromCalendars | type: ListEventFromCalendars | description: Configuration for importing events from the external calendar to the Wix site. - ONE-OF: - name: primaryCalendar | type: PrimaryCalendar | description: An empty `primaryCalendar` object indicates that you can import events only from the primary external calendar. Keep in mind that not all external calendar providers support primary calendars. EMPTY-OBJECT {} - name: calendars | type: Calendars | description: You can import events from the list of specified external calendar accounts. The list may include the primary calendar. - name: calendars | type: array | description: - name: id | type: string | description: GUID of the external calendar account. - name: name | type: string | description: Display name of the external calendar account. For example, `Primary` or `Birthdays`. - name: enabled | type: boolean | description: Whether you can call [List Events](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to import events from the external calendar to the Wix site. - name: syncToCalendar | type: SyncToCalendar | description: Configuration for exporting events from the Wix site to the external calendar. - ONE-OF: - name: primaryCalendar | type: PrimaryCalendar | description: An empty `primaryCalendar` object indicates that Wix events are exported only to the primary account of the external calendar. - name: dedicatedCalendar | type: DedicatedCalendar | description: An empty `dedicatedCalendar` object indicates that Wix events are exported only to the dedicated account of the external calendar. EMPTY-OBJECT {} - name: enabled | type: boolean | description: Whether Wix [events](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction.md) are exported to the external calendar. Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: NOT_SUPPORTED_BY_PROVIDER | Description: The external calendar provider doesn't support this operation. Use a different connection method or provider. ``` ### Examples ### Update connection to sync events to a new dedicated external account calendar ```curl curl -X PATCH 'https://www.wixapis.com/bookings/v2/external-calendars/connections/4WnvD8QzxhkAjVPBKUCvLIMpbuuUCMID7rYhqOpIGDae9JYyQj0JS71sdJukve86B38sWvS6TOvMQqBxszjEMNrrx8EGfFr5KhzpkCmfjBNJx2MSLZEkgEzGqEHtRYJ92LTUJ2w5v87FG2DafDaN3VSfbRlvSEqzXlgbEapLhGsm976gGw90KJd/sync-config' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ --data-raw '{ "syncConfig": { "syncToCalendar": { "enabled": true, "dedicatedCalendar": {} } } }' ``` ### Update connection to list events from specific external account calendars ```curl curl -X PATCH 'https://www.wixapis.com/bookings/v2/external-calendars/connections/4WnvD8QzxhkAjVPBKUCvLIMpbuuUCMID7rYhqOpIGDae9JYyQj0JS71sdJukve86B38sWvS6TOvMQqBxszjEMNrrx8EGfFr5KhzpkCmfjBNJx2MSLZEkgEzGqEHtRYJ92LTUJ2w5v87FG2DafDaN3VSfbRlvSEqzXlgbEapLhGsm976gGw90KJd/sync-config' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ --data-raw '{ "syncConfig": { "listEventFromCalendars": { "enabled": true, "calendars": { "calendars": [ { "id": "a68yu6lp6584z66zorp19z1ab" }, { "id": "4xve0tohyhnrlzy3lp4zf7b07" } ] } } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.calendar.ExternalCalendarService.updateSyncConfig(connectionId, syncConfig) Description: Updates the import and export settings for an external calendar connection's events. A connection's `syncConfig` object determines: + Whether events from 1 or more accounts belonging to the external calendar are imported to the connected [Wix schedule](https://dev.wix.com/docs/api-reference/business-management/calendar/schedules-v3/introduction.md). If importing events is enabled, you can call [List Events](https://dev.wix.com/docs/api-reference/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to retrieve external calendar events. + Whether events from the Wix schedule are exported to 1 or more accounts belonging to the external calendar. To check the current import and export settings, you can call [Get Connection](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/get-connection.md) or [List Connections](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-connections.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: connectionId, syncConfig Method parameters: param name: connectionId | type: string | description: GUID of the external calendar connection to update. | required: true param name: syncConfig | type: UpdateSyncConfig | required: true - name: listEventFromCalendars | type: ListEventFromCalendars | description: Configuration for importing events from the external calendar to the Wix site. - ONE-OF: - name: calendars | type: Calendars | description: You can import events from the list of specified external calendar accounts. The list may include the primary calendar. - name: calendars | type: array | description: - name: name | type: string | description: Display name of the external calendar account. For example, `Primary` or `Birthdays`. - name: enabled | type: boolean | description: Whether you can call [List Events](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to import events from the external calendar to the Wix site. - name: syncToCalendar | type: SyncToCalendar | description: Configuration for exporting events from the Wix site to the external calendar. - name: enabled | type: boolean | description: Whether Wix [events](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction.md) are exported to the external calendar. Return type: PROMISE - name: connection | type: Connection | description: Connection with updated sync configuration. - name: _id | type: string | description: GUID of the connection between the external calendar and the Wix site. - name: providerId | type: string | description: GUID of the external calendar provider. - name: calendarType | type: CalendarType | description: External calendar type. - enum: - UNDEFINED: There is no information about the external calendar type. - GOOGLE: [Google Calendar](https://developers.google.com/calendar/api/guides/overview). - I_CAL: Apple iCalendar. - OUTLOOK: __Deprecated__. Use `MICROSOFT` instead. - OFFICE_365: __Deprecated__. Use `MICROSOFT` instead. - MICROSOFT: Microsoft Calendar. For example, Office 365 calendar or Outlook calendar. - OTHER: A different type of external calendar, not listed here. - name: scheduleId | type: string | description: GUID of the [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md) that's connected to the external calendar. - name: userId | type: string | description: GUID of the [Wix user](https://dev.wix.com/docs/rest/articles/getting-started/about-identities.md#wix-user) to whom the external calendar connection belongs. - name: appId | type: string | description: GUID of the app which created the external calendar connection. - name: externalAccountEmail | type: string | description: Email address associated with the external calendar account. Available only after completed successfully. - name: status | type: Status | description: Connection status. - enum: - UNDEFINED: There is no information about the connection status. - CONNECTED: The external calendar is connected to the Wix [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md), but the sync process hasn't started yet. - SYNC_IN_PROGRESS: Sync process is ongoing. - SYNCED: The Wix calendar and the external calendar are in sync. - DISCONNECTED: The external calender has been disconnected from the Wix [schedule](https://dev.wix.com/docs/rest/business-management/calendar/schedules-v3/introduction.md). - ERROR: The calendars sync is in error state. - name: errorReason | type: ErrorReason | description: Reason for the error. Available only if `status` is `ERROR`. - enum: - UNDEFINED: There is no information about the connection error. - TOKEN_REVOKED: The external calendar's access token has been revoked. - EXTERNAL_CALENDAR_CREATION_FAILED: The external calendar couldn't be created. - EXTERNAL_CALENDAR_DELETED: The external calendar was deleted. - name: syncConfig | type: ConnectionSyncConfig | description: Settings about which sync operations are supported. - name: listEventFromCalendars | type: ListEventFromCalendars | description: Configuration for importing events from the external calendar to the Wix site. - ONE-OF: - name: calendars | type: Calendars | description: You can import events from the list of specified external calendar accounts. The list may include the primary calendar. - name: calendars | type: array | description: - name: _id | type: string | description: GUID of the external calendar account. - name: name | type: string | description: Display name of the external calendar account. For example, `Primary` or `Birthdays`. - name: enabled | type: boolean | description: Whether you can call [List Events](https://dev.wix.com/docs/rest/business-solutions/bookings/calendar/external-calendar-v2/list-events.md) to import events from the external calendar to the Wix site. - name: syncToCalendar | type: SyncToCalendar | description: Configuration for exporting events from the Wix site to the external calendar. - name: enabled | type: boolean | description: Whether Wix [events](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction.md) are exported to the external calendar. Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: NOT_SUPPORTED_BY_PROVIDER | Description: The external calendar provider doesn't support this operation. Use a different connection method or provider. ``` ### Examples ### Update connection to sync events to a new dedicated external account calendar (with elevated permissions) ```javascript import { externalCalendars } from '@wix/bookings'; import { auth } from '@wix/essentials'; const elevatedUpdateSyncConfig = auth.elevate(externalCalendars.updateSyncConfig); async function updateSyncConfig(connectionId) { const syncConfig = { syncToCalendar: { enabled: true, dedicatedCalendar: {} } } const { connection: updatedConnection } = await elevatedUpdateSyncConfig(connectionId, syncConfig) return updatedConnection } ``` ### Update connection to sync events to a new dedicated external account calendar ```javascript import {externalCalendars} from '@wix/bookings'; async function updateSyncConfig(connectionId) { const syncConfig = { syncToCalendar: { enabled: true, dedicatedCalendar: {} } } const {connection: updatedConnection} = await externalCalendars.updateSyncConfig(connectionId, syncConfig) return updatedConnection } ``` ### Update connection to list events from specific external account calendars (with elevated permissions) ```javascript import { externalCalendars } from '@wix/bookings'; import { auth } from '@wix/essentials'; const elevatedUpdateSyncConfig = auth.elevate(externalCalendars.updateSyncConfig); async function updateSyncConfig(connectionId) { const syncConfig = { listEventFromCalendars: { enabled: true, calendars: { calendars: [ { name: 'Family Plans' }, { name: 'Birthdays' } ] } } } const { connection: updatedConnection } = await elevatedUpdateSyncConfig(connectionId, syncConfig) return updatedConnection } ``` ### Update connection to list events from specific external account calendars ```javascript import {externalCalendars} from '@wix/bookings'; async function updateSyncConfig(connectionId) { const syncConfig = { listEventFromCalendars: { enabled: true, calendars: { calendars: [ { name: 'Family Plans' }, { name: 'Birthdays' } ] } } } const {connection: updatedConnection} = await externalCalendars.updateSyncConfig(connectionId, syncConfig) return updatedConnection } ``` ### updateSyncConfig (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { externalCalendars } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { externalCalendars }, // Include the auth strategy and host as relevant }); async function updateSyncConfig(connectionId,syncConfig) { const response = await myWixClient.externalCalendars.updateSyncConfig(connectionId,syncConfig); }; ``` ---