Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confluence REST API to read Calendar events

I didn't find any official REST API to read calendar events but got to know about an unofficial end point to get event data in one of the discussion thread.

https://stackoverflow.com/questions/44412554/calendar-info-using-confluence-api

https://community.atlassian.com/t5/Answers-Developer-Questions/Team-Calendar-list-events-API/qaq-p/532723

 

End point - https://yourconfluence.com/rest/calendar-services/1.0/calendar/events.json?subCalendarId=40xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&userTimeZoneId=US%2FPacific&start=2019-01-28T00%3A00%3A00Z&end=2019-06-28T00%3A00%3A00Z

 

Curl response I'm getting is {"success":true} but it doesn't have any event list. I did verified date ranges again and again and we have events within input date range.

 

So, is there something I'm doing wrong here? Any pointers? Thanks.

 

4 answers

2 accepted

2 votes
Answer accepted

Hello Vaibhav and welcome to the Community!

The REST API endpoint you’re using may be responding, but it doesn’t seem to be fully developed as of now. There is a feature request for Confluence Server to have this added under support. You may find that feature request at CONFSERVER-51323. We would suggest you vote and watch this request to receive future updates.

As of now, there is not an available REST API endpoint which will give you access to the calendar events.

Regards,
Stephen Sifers

Thanks Stephen for your response. I will vote for feature request.

Like # people like this
2 votes
Answer accepted

Hey, just letting you (and anyone who stumbles across this post, like I did) know, the unofficial API is currently working.

I got the same problem as you, and eventually figured out that the cause was the structure of the calendar itself. It appears that Team Calendars stores each calendar as multiple sub-calendars, with each sub-calendar managing a different type of event (e.g. Leave, Travel, etc).

So it's returning success=true because technically that call is doing what it's supposed to: it's just there are no events associated with the derived calendar - which is likely to be the ID you're using - they're all in the sub-calendars.

The way I found to get it working was by using the ID's of the sub-calendars instead. The easiest way I found to figure those out is to go into the network calls. There you should find some number of calls (that correspond to the number of event types of events in that time range) that start like events.json?subCalendarId=<some numbers>. You can copy the URL's of those calls, and they'll give you the sub-calendar ID's and the different API calls you need to make. 

Good luck!

I was having the same challenge and found rest/calendar-services/1.0/calendar/subcalendars.json? returns all the calenders I am subscribed to parents and all. I then went through the list to get the subcalender IDs and get the events for each sub calender.

The Simple Solution (But not exactly REST) is to use the iCal export (the subscribe button).  Then use an iCal library to parse the data. 

This snippet may help as I experienced the same issue.

Looking at the URL you posted the arguments seem to be missing this argument _ , which appears to be a timestamp/epoch. Once I added this value I received events and not just

{"success":true} 

Take a look at this Laravel/PHP code snippet that works for me


$response
= Http::withToken(config('confluence.api.token'))
->get(sprintf('https://%s/rest/calendar-services/1.0/calendar/events.json',
config('confluence.api.hostname')),
[
'subCalendarId' => config('confluence.calendar.sub_calendar_id'),
'userTimeZoneId' => 'Australia/Sydney',
'start' => $this->argument('start'),
'end' => $this->argument('end'),
'_' => now()->timestamp,
]);

 The now()->timestamp is essentially the same as this bash command

date "+%s"
1614030878

 Hope that helps

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

138 views 1 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you