This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Calendar Events in Canvas
Overview
The following operations allow you to work with calendar events. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with calendar events, see Sample configuration.
Operation | Description |
---|---|
Creates a calendar event. | |
getCalendarEvent | Retrieves a calendar event by ID. |
listCalendarEvents | Retrieves the calendar events of a user. |
Operation details
This section provides further details on the operations related to calendar events.
Creating a calendar event
The createCalendarEvent
operation creates a calendar event for a user.
<canvas.createCalendarEvent> <childEventContextCode>{$ctx:childEventContextCode}</childEventContextCode> <title>{$ctx:title}</title> <childEventEndTimes>{$ctx:childEventEndTimes}</childEventEndTimes> <childEventStartTimes>{$ctx:childEventStartTimes}</childEventStartTimes> <description>{$ctx:description}</description> <contextCode>{$ctx:contextCode}</contextCode> <startAt>{$ctx:startAt}</startAt> <locationName>{$ctx:locationName}</locationName> <endAt>{$ctx:endAt}</endAt> <timeZoneEdited>{$ctx:timeZoneEdited}</timeZoneEdited> <locationAddress>{$ctx:locationAddress}</locationAddress> </canvas.createCalendarEvent>
Properties
Context code(s) corresponding to the section-level start and end time(s).childEventContextCode:
The short title for the calendar event.title:
The end date/time of the child event.childEventEndTimes:
The start date/time of the child event.childEventStartTimes:
The longer description of the event.description:
The context code of the course/group/user whose calendar this event should be added to.contextCode:
The start date/time of the event.startAt:
The location name of the event.locationName:
The end date/time of the event.endAt:
The time zone of the user editing the event.timeZoneEdited:
The location address of the event.locationAddress:
Sample request
Following is a sample REST/JSON request that can be handled by the createCalendarEvent operation.
{ "apiUrl":"https://canvas.instructure.com", "accessToken":"7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "childEventContextCode":"", "title":"Test Event", "childEventEndTimes":"", "childEventStartTimes":"", "description":"<b>It's that time again!</b>", "contextCode":"course_893239", "startAt":"2014-11-10T01:00:00Z", "locationName":"Virtusa World", "endAt":"2014-11-18T01:00:00Z", "timeZoneEdited":"", "locationAddress":"Collaboration,Virtusa World" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/calendar_events.html#method.calendar_events_api.create
Retrieving a calendar event
The
operation retrieves a calendar event by ID.getCalendarEvent
<canvas.getCalendarEvent> <calendarEventId>{$ctx:calendarEventId}</calendarEventId> </canvas.getCalendarEvent>
Properties
The ID of the calendar event to retrieve.calendarEventId:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.getCalendarEvent
{ "apiUrl":"https://canvas.instructure.com", "accessToken":"7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "calendarEventId":"869358" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/calendar_events.html#method.calendar_events_api.show
Retrieving a list of calendar events
The
operation retrieves a list of calendar events of a user.listCalendarEvents
<canvas.listCalendarEvents> <startDate>{$ctx:startDate}</startDate> <undated>{$ctx:undated}</undated> <page>{$ctx:page}</page> <allEvents>{$ctx:allEvents}</allEvents> <endDate>{$ctx:endDate}</endDate> <perPage>{$ctx:perPage}</perPage> <type>{$ctx:type}</type> <contextCodes>{$ctx:contextCodes}</contextCodes> </canvas.listCalendarEvents>
Properties
The event start date. Only returns events that occur on or after the start date. Defaults to "today".startDate:
If "true", only returns undated events and ignoresundated:
startDate
andendDate
.
The page number of results to retrieve.page:
If "true", returns all events, ignoringallEvents:
startDate
,endDate
, and undated criteria.
The event end date. Only returns events that occur on or before the end date. Defaults to startDate.endDate:
The number of results to list per page.perPage:
The event type, either "event" or "assignment". Default is "event".type:
A comma-separated list of context codes of courses/groups/users whose events you want to see.contextCodes:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.listCalendarEvents
{ "apiUrl":"https://canvas.instructure.com", "accessToken":"7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "startDate":"", "undated":"", "allEvents":"true", "endDate":"", "type":"", "perPage":"4", "contextCodes":"course_893239 ,course_893240", "page":"1" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/calendar_events.html#method.calendar_events_api.index
Sample configuration
Following is a sample proxy service that illustrates how to connect to calendar events with the init
operation and use the createCalendarEvent operation. The sample request for this proxy can be found in the createCalendarEvent sample request.
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="canvas_createCalendarEvent" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="childEventContextCode" expression="json-eval($.childEventContextCode)"/> <property name="title" expression="json-eval($.title)"/> <property name="childEventEndTimes" expression="json-eval($.childEventEndTimes)"/> <property name="childEventStartTimes" expression="json-eval($.childEventStartTimes)"/> <property name="description" expression="json-eval($.description)"/> <property name="contextCode" expression="json-eval($.contextCode)"/> <property name="startAt" expression="json-eval($.startAt)"/> <property name="locationName" expression="json-eval($.locationName)"/> <property name="endAt" expression="json-eval($.endAt)"/> <property name="timeZoneEdited" expression="json-eval($.timeZoneEdited)"/> <property name="locationAddress" expression="json-eval($.locationAddress)"/> <canvas.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> </canvas.init> <canvas.createCalendarEvent> <childEventContextCode>{$ctx:childEventContextCode}</childEventContextCode> <title>{$ctx:title}</title> <childEventEndTimes>{$ctx:childEventEndTimes}</childEventEndTimes> <childEventStartTimes>{$ctx:childEventStartTimes}</childEventStartTimes> <description>{$ctx:description}</description> <contextCode>{$ctx:contextCode}</contextCode> <startAt>{$ctx:startAt}</startAt> <locationName>{$ctx:locationName}</locationName> <endAt>{$ctx:endAt}</endAt> <timeZoneEdited>{$ctx:timeZoneEdited}</timeZoneEdited> <locationAddress>{$ctx:locationAddress}</locationAddress> </canvas.createCalendarEvent> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>