Calendar API

Calendar API

core_calendar_create_calendar_events

This function is used to create new calendar events. You can create events for a user, a course, or a group.

Let's review the POST parameters for this function:

  1. Required Parameters:
    • events[0][name]= string (Required: The title of the calendar event.)
    • events[0][timestart]= int (Required: The start time for the event, formatted as a Unix timestamp.)
  2. Optional Parameters:
    • events[0][description]= string (Optional: A detailed description of the event.)
    • events[0][eventtype]= string (Optional: The context of the event. Can be 'user', 'course', 'group', 'site', or 'category'. Defaults to 'user'.)
    • events[0][courseid]= int (Optional: The ID of the course this event is associated with. Required if eventtype is 'course'.)
    • events[0][timeduration]= int (Optional: The duration of the event in seconds. If 0, the event is considered to have no end time.)
    • events[0][repeats]= int (Optional: The number of times the event repeats.)

cURL Command Example (Creating a Calendar Event):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_calendar_create_calendar_events" \
-d "events[0][name]=Team Strategy Meeting" \
-d "events[0][description]=Discuss Q4 goals and project timelines." \
-d "events[0][timestart]=1759526400" \
-d "events[0][timeduration]=3600"



core_calendar_delete_calendar_events

This function is used to delete one or more calendar events using their unique event ID.

Let's review the POST parameters for this function:

  1. Required Parameter:
    • events[0][eventid]= int (Required: The unique ID of the calendar event to delete.)
  2. Optional Parameter:
    • events[0][repeat]= int (Optional: Set to 1 to delete all occurrences of a repeating event, or 0 to delete only this specific instance. Defaults to 0.)

cURL Command Example (Deleting a Calendar Event):

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_calendar_delete_calendar_events" \
-d "events[0][eventid]=456" \
-d "events[0][repeat]=0"
    • Related Articles

    • Grades API

      gradereport_overview_get_course_grades This function retrieves an overview of all final course grades for a specific user. Let's review the POST parameters for this function: Optional Parameter: userid= int (Optional: The numeric ID of the user. If ...
    • User API

      core_user_create_users We advise the use of a developer to help you setup your API connection. This example shows how to create new users. Let's review the POST parameters for this function: Required Parameters: users[0][username]= string (Required: ...
    • Generate your API Key

      Step 1: Click on "Site admin" > "Integrations" > "Manage tokens": Step 2: Click on "Create Token": Step 3: (1) Select the user you wish to give the API Token to, (2) Select "API" then (3) Save: Step 4: Share this token with the user or save it if ...
    • Setting Up Your API

      We advise the use of a developer to help you setup your API connection. We will offer an example of how to CREATE A NEW USER on your LMS using a cURL command. Let's review the required POST parameters for the core_user_create_users function: ...
    • SCORM API

      mod_scorm_get_scorm_user_data This function retrieves detailed user tracking data for a specific attempt on a SCORM package. Let's review the POST parameters for this function: Required Parameters: scormid= int (Required: The numeric instance ID of ...