Import Team Calendar .ics files through API in Confluence Data Center
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Currently we have a feature request opened to Export and Import The Whole Calendar Data in Confluence Instance.
If we want to migrate a significant amount of calendars, we don't have an official feature released to bulk data import/export for team calendars, so this KB provides a work around on how to import the previously exported .ics Team Calendars files through API.
Exporting Team Calendar
For the steps on how to export the Team Calendar into .ics format so we can import later. We can either do it manually by using the KB: Export Team Calendars Content to Other Calendars or through API by using the KB: How to export Team Calendars .ics file via REST API in Confluence.
Importing the Team Calendar .ics file
After we have the .ics file of the exported calendar, we'll use the following API to import the previously created .ics file:
1- Fill the user:password with the Confluence Admin user and password.
2- Change the <CONFLUENCE_URL> to your Confluence Base URL
3- Change the <SPACE-KEY> to the Space destination you're importing
4- Change the <CalendarName> to the name you prefer; This will be the name showing on the Space when you look for the Calendars.
5- Change the </PATH-TO-ICS-File> to the path and name of the .ics file you're going to import.
6- Run the below API with the changes from steps 1 to 5.
curl -vvv -u user:password -X POST '<CONFLUENCE_URL>/plugins/calendar/importsubcalendar.action' \ -H 'X-Atlassian-Token: no-check' \ -F "spaceKey=<SPACE-KEY>" \ -F "name=<CalendarName>" \ -F "file_0=@</PATH-TO-ICS-File>"
Other References
There's also another feature request opened to be able to officially manipulate Calendar events through API: CONFSERVER-51696 - Provide API to create, edit and remove events from a calendar
As a workaround for manipulating this creation of events through API, we also have the KB: REST API to create Team Calendar's events.