Skip to main content
This document describes how to call the Calendar API to create events and perform related operations. First, create an internal app, then use the APIs provided by Calendar to create, modify, query the details of a single event, and delete an event.

Expected result

After an event is created, the result is as follows:

Integration flow overview

This document demonstrates how to create an internal app and then use the APIs provided by Calendar to create, modify, query the details of a single event, and delete an event. Prerequisite: Complete the Create and configure an app flow. Step 1: Obtain the app credential information, including the client ID and Client Secret. Step 2: Request API permissions for the Calendar-related APIs. Step 3: Obtain the app access credential Obtain the access token of an internal app. When calling an API, use the access token to authenticate the caller. Step 4: Call the Server API for Calendar:
  1. Call the Server API New Event to create an event. Obtain the event id.
  2. Based on the event id, call the Server API Modify event to modify the event information.
  3. Based on the event id, call the Server API Query details about an event to obtain the event details.
  4. Based on the event id, call the Server API Delete Event to delete the created event.

Prerequisites

Complete the Create and configure an app flow.

Step 1: Obtain the app credential

  1. Select the target app to enter the app details page, then click Basic information > Credentials and basic information.
  2. Obtain the client ID and Client Secret.

Step 2: Add API permissions

Click Development configuration > Manage permissions. In the permission search box, enter Calendar.Event.Write and Calendar.Event.Read respectively, and request the permissions.

Step 3: Obtain the app access token

For details on the differences between Server APIs, see Legacy API vs. New API. The following APIs all use Server APIs. For SDK download details, see Server-side SDK download.
Use the client ID and Client Secret from Step 1 to obtain the access_token of an internal app.

Step 4: Call the Server API for Calendar

  1. Call the Server API New Event to create an event. Obtain the event id.
  2. Based on the event id, call the Server API Modify event to modify the event information.
  3. Based on the event id, call the Server API Query details about an event to obtain the event details.
  4. Based on the event id, call the Server API Delete Event to delete the created event.
The following two deletion scenarios are supported:
  • When the organizer deletes the event (the userId parameter in the path uses the organizer’s unionId), all attendees receive an event cancellation notification, and the event is removed from all attendees’ calendars.
  • When an attendee deletes the event (the userId parameter in the path uses the attendee’s unionId), the event is removed only from that attendee’s own calendar, and other event attendees are not affected.