Fetch entries from a calendar through an API

Hello,

How can I fetch entries from a Nextcloud calendar for a limited time range through some API?

The background is that I want to show free/busy times (or actually possible times for an appointment) of a single user over the next few weeks in a web form on my own website. The website is written in PHP and it can use JavaScript in the browser. But for privacy and security reasons, I guess it’ll be better to do the Nextcloud request from the server and then only pass on the processed view data to the web page.

The calendar is also relatively busy and actively used for a couple of years, so I really don’t want to fetch all calendar entries but just those of the upcoming weeks.

Is there an API for this? Maybe REST API or some JSON file or maybe even CalDAV (I still need to parse that though).

Also, can I use access tokens for this request or will I have to store the user’s password in the website source code (or create another user for it)?

PS: The next task will be to also create an appointment in that calendar so that the time will be blocked and the user can also see it there.

1 Like

Maybe this thread is helpful for you: Get Calendar Events as JSON