CalDAV APIs implement the RFC Spec that uses HTTP methods for communication between client and server.
Typical API call URL contains username
, password
, domain-url
, and calendar-ID
.
1 2curl -i -u <username>:<password> -X OPTIONS 'https://<domain-url>/confluence/plugins/servlet/team-calendars/caldav/<calendar-ID>'
Where:
domain-url
is the Confluence URL
calendar-ID
is the ID of a specific calendar
A call to extract events from the calendar would look like the this:
1 2curl --location --request REPORT 'https://<domain-url>/confluence/plugins/servlet/team-calendars/caldav/<calendar-id>' \ --header 'Content-Type: application/xml' \ --header 'depth: 1' \ --header 'charset: "utf-8"' \ --header 'Authorization: Bearer OTkwNTA3Mjg1Nzk3OpbvQ75bpP0j9gZPiqy8Oiowk9OT' \ --data ' <?xml version="1.0" encoding="utf-8" ?> <C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"> <D:prop> <D:getetag/> <C:calendar-data> <C:comp name="VCALENDAR"> <C:prop name="VERSION"/> <C:comp name="VEVENT"> <C:prop name="SUMMARY"/> <C:prop name="UID"/> <C:prop name="DTSTART"/> <C:prop name="DTEND"/> <C:prop name="DURATION"/> <C:prop name="RRULE"/> <C:prop name="RDATE"/> <C:prop name="EXRULE"/> <C:prop name="EXDATE"/> <C:prop name="RECURRENCE-ID"/> </C:comp> <C:comp name="VTIMEZONE"/> </C:comp> </C:calendar-data> </D:prop> <C:filter> <C:comp-filter name="VCALENDAR"> <C:comp-filter name="VEVENT"> <C:time-range start="20060104T000000Z" end="20060105T000000Z"/> </C:comp-filter> </C:comp-filter> </C:filter> </C:calendar-query>'
A call to create a new event within a specific calendar would look like this:
1 2curl --location --request PUT 'https://<domain-url>/confluence/plugins/servlet/team-calendars/caldav/<calendar-id>' \ --header 'Content-Type: application/xml' \ --header 'depth: 1' \ --header 'charset: "utf-8"' \ --header 'Authorization: Bearer OTkwNTA3Mjg1Nzk3OpbvQ75bpP0j9gZPiqy8Oiowk9OT' \ --data ' <?xml version="1.0" encoding="utf-8" ?> <C:mkcalendar xmlns:D='DAV:'xmlns:C='urn:ietf:params:xml:ns:caldav'> <D:set> <D:prop> <D:displayname>Test Calendar</D:displayname> <C:calendar-description>Test Calendar</C:calendar-description> <C:calendar-data> <![CDATA[ BEGIN:VCALENDAR BEGIN:VEVENT UID:test123 SUMMARY:Test Event DTSTART=20140920T080000 DTEND=20140920T170000 END:VEVENT END:VCALENDAR]]> </C:calendar-data> </D:prop> </D:set> </C:mkcalendar>'
To avoid manually creating the XML content for querying the API, you can use Python or another implementation with CalDAV libraries to generate these calls. Alternatively, you can use a CalDav client application.
Rate this page: