Get Calendar Events as JSON

I’m trying to figure out a way to get my nextcloud calendar events returned in a json format. I’ve read through the documentation, but I’m not sure if I’m looking in the right place. I’m trying this:


But I can’t seem to get anywhere. Is there a service endpoint or other way to do this? I’m looking into using JavaScript/Ajax to parse through my calendar.

Thanks in advance.

I don‘t know how to retrieve single events in json format. But you can get complete calendars in jcal format with (jcal = json for iCalendars):


where URI for the desired calendar can be looked up in the database table oc_calendars (your table prefix might differ from oc_).
Of course you also need to authenticate with username and password in the request - I would not put the user credentials in the URL though.

That’s the WebDav url I believe. It appears to give me this message when attempting to access it via browser:

This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

I’m able to curl forcing the method to be PROPFIND, but I’m not seeing a list of events in json format…

Yes, this is the WebDAV-URL, but the export function works with a http client. Are you sure you appended the query-string for the get-request properly?
If I enter that link (including the query-string ?export&accept=jcal!) in a browser or request it via curl - I get a calender in json format. I know that at least the export function as an ics-file (without &accept=jcal) works since Nextcloud 9.0
Without the query-string I also get „This is the webdav interface…“

I believe I got this working. I was looking at the principleuri field instead of uri in the database… The uri was called “personal”.

The json response is huge, is there any documentation on this export param or any other query parameters to reduce the size of the json response? I can’t seem to find any documentation on it.

You could add a start and end date.
I don‘t know of any documentation except the comments in the code:

IMHO there is actually a mistake: in line 20 it should probably be ?export(and not ?expand)
I hope that helps :slight_smile:

Thanks for this.

1 Like