Calendars & Events
Learn how to manage calendars and events of your connected accounts.
Feature available for: Google, Microsoft.
Get calendars
To list existing calendars, use the GET /calendars method.
curl --request GET \
--url 'https://api.postpress.ai/api/v1/calendars?limit=10&account_id=5D586za6a-aAaasqXX' \
--header 'X-API-KEY: {YOUR_ACCESS_TOKEN}' \
--header 'accept: application/json'This method uses pagination.
Get events
The postpress API gives you two options to retrieve events in your application.
In realtime with Webhooks
The recommended approach to listen for events in your application is to use a webhook, because they trigger in real time. Whenever the user account creates or updates a calendar event, the webhook will call your specified URL with the given calendar event that you can store and display.
→ More information on the calendar webhook.
With a cron job
If your system cannot handle webhooks, or if you don't need real time, you can create a cron job calling GET /events at intervals.
We advise fetching a larger period than your cron delay to account for any potential disconnects or errors that may result in losing outdated events. In this case, implementing a unique ID verification on your history entry based on the event ID can help prevent duplicate entries.
Create and update events
You can create, update, delete, or retrieve an event:
- Create an event -
POST /calendars/{calendar_id}/events - Update an event -
PATCH /calendars/{calendar_id}/events/{event_id} - Delete an event -
DELETE /calendars/{calendar_id}/events/{event_id} - Retrieve an event -
GET /calendars/{calendar_id}/events/{event_id}