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 Courses in Canvas
Overview
The following operations allow you to work with courses. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with courses, see Sample configuration.
Operation | Description |
---|---|
Creates a new course for the teacher. | |
getCourse | Retrieves a course by ID. |
getCourseUser | Retrieves a user belonging to a course. |
listCourses | Retrieves courses created by the teacher. |
listCourseUsers | Retrieves all the users belonging to a course. |
enrollUser | Enrolls a user for a course. |
Operation details
This section provides further details on the operations related to courses.
Creating a course
The createCourse operation creates a new course for the teacher.
<canvas.createCourse> <accountId>{$ctx:accountId}</accountId> <name>{$ctx:name}</name> <code>{$ctx:code}</code> <startAt>{$ctx:startAt}</startAt> <endAt>{$ctx:endAt}</endAt> <license>{$ctx:license}</license> <isPublic>{$ctx:isPublic}</isPublic> <publicSyllabus>{$ctx:publicSyllabus}</publicSyllabus> <publicDescription>{$ctx:publicDescription}</publicDescription> <allowStudentWikiEdits>{$ctx:allowStudentWikiEdits}</allowStudentWikiEdits> <allowWikiComments>{$ctx:allowWikiComments}</allowWikiComments> <allowStudentForumAttachments>{$ctx:allowStudentForumAttachments}</allowStudentForumAttachments> <openEnrollment>{$ctx:openEnrollment}</openEnrollment> <selfEnrollment>{$ctx:selfEnrollment}</selfEnrollment> <restrictEnrollmentsToCourseDates>{$ctx:restrictEnrollmentsToCourseDates}</restrictEnrollmentsToCourseDates> <termId>{$ctx:termId}</termId> <sisCourseId>{$ctx:sisCourseId}</sisCourseId> <integrationId>{$ctx:integrationId}</integrationId> <hideFinalGrades>{$ctx:hideFinalGrades}</hideFinalGrades> <applyAssignmentGroupWeights>{$ctx:applyAssignmentGroupWeights}</applyAssignmentGroupWeights> <gradingStandardId>{$ctx:gradingStandardId}</gradingStandardId> <syllabusBody>{$ctx:syllabusBody}</syllabusBody> <enrollMe>{$ctx:enrollMe}</enrollMe> <offer>{$ctx:offer}</offer> </canvas.createCourse>
Properties
The ID of the Canvas admin account to which the course belongs.accountId:
The name of the course. If omitted, the course is named "Unnamed Course".name:
The course code.code:
The course start date in the ISO8601 format, e.g., 2011-01-01T01:00Z.startAt:
The course end date in the ISO8601 format, e.g., 2011-01-01T01:00Z.endAt:
The name of the licensing used when publishing the course.license:
Whether the course is public or private in Canvas.isPublic:
Sets to "true" to make the course syllabus public.publicSyllabus:
A publicly visible description of the course.publicDescription:
If "true", allows students to modify the course wiki.allowStudentWikiEdits:
If "true", allows course members to comment on wiki pages.allowWikiComments:
If "true", allows students to attach files to forum posts.allowStudentForumAttachments:
Set to "true" if the course is "open enrollment".openEnrollment:
Set to "true" if the course is "self enrollment".selfEnrollment:
Set to "true" to restrict user enrollments to the start and end dates of the course.restrictEnrollmentsToCourseDates:
The unique ID of the term to create a course.termId:
The unique SIS identifier.sisCourseId:
The unique integration identifier.integrationId:
If set to "true", hides the totals in the student grades summary.hideFinalGrades:
Set to "true" to weight final grade based on assignment groups percentages.applyAssignmentGroupWeights:
The grading standard ID to set for the course. If no value is provided for this argument, the current grading standard is un-set from this course.gradingStandardId:
The syllabus body for the course.syllabusBody:
Set to "true" to enroll the current user as the teacher.enrollMe:
If set to "true", makes the course available to students immediately.offer:
Sample request
Following is a sample REST/JSON request that can be handled by the createCourse
operation.
{ "publicSyllabus": true, "sisCourseId": "", "accountId": "81259", "accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "allowWikiComments": true, "gradingStandardId": "", "endAt": "2014-11-05T09:00Z", "allowStudentForumAttachments": "", "termId": "", "name": "Canvas EJB Course 1.0", "enrollMe": true, "license": "public_domain", "hideFinalGrades": false, "allowStudentWikiEdits": true, "applyAssignmentGroupWeights": true, "code": "Can-EJB-1.0", "isPublic": true, "offer": true, "publicDescription": "This is a public description.", "openEnrollment": true, "apiUrl": "https://canvas.instructure.com", "integrationId": "", "startAt": "2014-11-04T09:00Z", "syllabusBody": "<p>This is the Syllabus body</p>", "restrictEnrollmentsToCourseDates": "", "selfEnrollment": true }
Related Canvas documentation
https://canvas.instructure.com/doc/api/courses.html#method.courses.create
Retrieving a course
The getCourse operation retrieves a course by ID.
<canvas.getCourse> <accountId>{$ctx:accountId}</accountId> <courseId>{$ctx:courseId}</courseId> <include>{$ctx:include}</include> </canvas.getCourse>
Properties
The ID of the Canvas admin account to which the course belongs.accountId:
The ID of the course whose users should be listed.courseId:
Includes optional details of the course that is being retrieved.include:
Sample request
Following is a sample REST/JSON request that can be handled by the getCourse operation.
{ "accountId": "81259", "accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "apiUrl": "https://canvas.instructure.com", "courseId": "893240", "include": "all_courses,permissions" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/courses.html#method.courses.show
Retrieving a user belonging to a course
The
operation retrieves a user belonging to a course by ID.getCourseUser
<canvas.getCourseUser> <courseId>{$ctx:courseId}</courseId> <userId>{$ctx:userId}</userId> </canvas.getCourseUser>
Properties
The ID of the course whose user should be retrieved.courseId:
The ID of the user to be retrieved.userId:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.getCourseUser
{ "accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "userId": "4213615", "apiUrl": "https://canvas.instructure.com", "courseId": "897098" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/courses.html#method.courses.user
Retrieving courses
The
operation retrieves a list of active courses for the current user.listCourses
<canvas.listCourses> <enrollmentType>{$ctx:enrollmentType}</enrollmentType> <enrollmentRole>{$ctx:enrollmentRole}</enrollmentRole> <include>{$ctx:include}</include> <state>{$ctx:state}</state> <perPage>{$ctx:perPage}</perPage> <page>{$ctx:page}</page> </canvas.listCourses>
Properties
When set, only return courses where the user is enrolled as this type. This argument is ignored if enrollment_role is given.enrollmentType:
When set, only return courses where the user is enrolled with the specified course-level role.enrollmentRole:
Include optional details of each course being listed. The values that can be passed are needs_grading_count, syllabus_body, total_scores, term, course progress, section. For further information, see https://canvas.instructure.com/doc/api/courses.html#method.courses.index.include:
State(s) of the courses to be listed.state:
The number of results to return per page. For more information on pagination, see https://canvas.instructure.com/doc/api/file.pagination.html.perPage:
Number of the page to return.page:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.listCourses
{ "accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "enrollmentRole": "TeacherEnrollment", "state": "available", "apiUrl": "https://canvas.instructure.com", "enrollmentType": "teacher", "perPage": "3", "page": "1", "include": "needs_grading_count,syllabus_body,total_scores,term,course_progress,sections" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/courses.html#method.courses.index
Retrieving all users
The
operation retrieves all users belonging to a course.listCourseUsers
<canvas.listCourseUsers> <searchTerm>{$ctx:searchTerm}</searchTerm> <userId>{$ctx:userId}</userId> <enrollmentType>{$ctx:enrollmentType}</enrollmentType> <enrollmentRole>{$ctx:enrollmentRole}</enrollmentRole> <include>{$ctx:include}</include> <page>{$ctx:page}</page> <perPage>{$ctx:perPage}</perPage> <courseId>{$ctx:courseId}</courseId> </canvas.listCourseUsers>
Properties
The partial name or full ID of the users to match and return in the results list.searchTerm:
If included, queries the user, and if the user is part of the users set, modifies the page parameter so that the page containing user_id is returned.userId:
When set, only returns users where the user is enrolled as this type. This argument is ignored if enrollment_role is given.enrollmentType:
When set, only returns users enrolled with the specified course-level role.enrollmentRole:
Includes optional details of each user being listed.include:
The number of the page to return. For more information on pagination, see https://canvas.instructure.com/doc/api/file.pagination.html.page:
The number of results to return per page.perPage:
The ID of the course whose users should be listed.courseId:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.listCourseUsers
{ "accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO", "searchTerm": "", "enrollmentRole": "", "userId": "", "apiUrl": "https://canvas.instructure.com", "enrollmentType": "", "perPage": "5", "page": "1", "courseId": "897098", "include": "email,enrollments,locked,avatar_url,test_student" }
Related Canvas documentation
https://canvas.instructure.com/doc/api/courses.html#method.courses.users
Enrolling a user
The
operation enrolls a user for a course in Canvas.enrollUser
<canvas.enrollUser> <courseSectionId>{$ctx:courseSectionId}</courseSectionId> <limitPrivilegesToCourseSection>{$ctx:limitPrivilegesToCourseSection}</limitPrivilegesToCourseSection> <enrollmentState>{$ctx:enrollmentState}</enrollmentState> <selfEnrollmentCode>{$ctx:selfEnrollmentCode}</selfEnrollmentCode> <enrollmentRole>{$ctx:enrollmentRole}</enrollmentRole> <enrollmentType>{$ctx:enrollmentType}</enrollmentType> <courseId>{$ctx:courseId}</courseId> <userId>{$ctx:userId}</userId> <notify>{$ctx:notify}</notify> </canvas.enrollUser>
Properties
The ID of the course section to enroll the student to.courseSectionId:
If a teacher or TA enrollment, restricts the teacher/TA to the section given by course_section_id.limitPrivilegesToCourseSection:
If set to "active", immediately enrolls the student to the course. Otherwise, the student will be required to accept a course invitation. Default: "invited".enrollmentState:
If the current user is not allowed to manage enrollments in this course, but the course allows self-enrollment, allows the user to self-enroll as a student in the default section by passing in a valid code.selfEnrollmentCode:
Assigns a custom course-level role to the user.enrollmentRole:
Enrolls the user as a student, teacher, TA, observer, or designer.enrollmentType:
courseId:
The ID of the course to which the user is being enrolled.userId:
The ID of the user to be enrolled in the course.notify:
If "true", sends a notification to the enrolled user. Notifications are not sent by default.
Sample request
Following is a sample REST/JSON request that can be handled by the enrollUser operation.
{ "apiUrl":"https://orion-city.acme.instructure.com", "accessToken":"51451~fwK08jirhrTKFiuyua8H3rpFVQtZJu7D7rf3mi7pecuHxMglbY24XOxQ42UWTvam", "courseSectionId":"", "limitPrivilegesToCourseSection":true, "enrollmentState":"", "selfEnrollmentCode":"", "enrollmentRole":"", "enrollmentType":"StudentEnrollment", "courseId":"96", "userId":"14", "notify":true }
Related Canvas documentation
https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.create
Sample configuration
Following is a sample proxy service that illustrates how to connect to Canvas with the init
operation and use the createCourse operation. The sample request for this proxy can be found in the createCourse sample request. You can use this sample as a template for using other operations in this category.
<?xml version="1.0" encoding="UTF-8"?> <proxy name="canvas_createCourse" startOnLoad="true" statistics="disable" trace="disable" transports="https,http" xmlns="http://ws.apache.org/ns/synapse"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="accountId" expression="json-eval($.accountId)"/> <property name="name" expression="json-eval($.name)"/> <property name="code" expression="json-eval($.code)"/> <property name="startAt" expression="json-eval($.startAt)"/> <property name="endAt" expression="json-eval($.endAt)"/> <property name="license" expression="json-eval($.license)"/> <property name="isPublic" expression="json-eval($.isPublic)"/> <property name="publicSyllabus" expression="json-eval($.publicSyllabus)"/> <property name="publicDescription" expression="json-eval($.publicDescription)"/> <property name="allowStudentWikiEdits" expression="json-eval($.allowStudentWikiEdits)"/> <property name="allowWikiComments" expression="json-eval($.allowWikiComments)"/> <property name="allowStudentForumAttachments" expression="json-eval($.allowStudentForumAttachments)"/> <property name="openEnrollment" expression="json-eval($.openEnrollment)"/> <property name="selfEnrollment" expression="json-eval($.selfEnrollment)"/> <property name="restrictEnrollmentsToCourseDates" expression="json-eval($.restrictEnrollmentsToCourseDates)"/> <property name="termId" expression="json-eval($.termId)"/> <property name="sisCourseId" expression="json-eval($.sisCourseId)"/> <property name="integrationId" expression="json-eval($.integrationId)"/> <property name="hideFinalGrades" expression="json-eval($.hideFinalGrades)"/> <property name="applyAssignmentGroupWeights" expression="json-eval($.applyAssignmentGroupWeights)"/> <property name="gradingStandardId" expression="json-eval($.gradingStandardId)"/> <property name="syllabusBody" expression="json-eval($.syllabusBody)"/> <property name="enrollMe" expression="json-eval($.enrollMe)"/> <property name="offer" expression="json-eval($.offer)"/> <canvas.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> </canvas.init> <canvas.createCourse> <accountId>{$ctx:accountId}</accountId> <name>{$ctx:name}</name> <code>{$ctx:code}</code> <startAt>{$ctx:startAt}</startAt> <endAt>{$ctx:endAt}</endAt> <license>{$ctx:license}</license> <isPublic>{$ctx:isPublic}</isPublic> <publicSyllabus>{$ctx:publicSyllabus}</publicSyllabus> <publicDescription>{$ctx:publicDescription}</publicDescription> <allowStudentWikiEdits>{$ctx:allowStudentWikiEdits}</allowStudentWikiEdits> <allowWikiComments>{$ctx:allowWikiComments}</allowWikiComments> <allowStudentForumAttachments>{$ctx:allowStudentForumAttachments}</allowStudentForumAttachments> <openEnrollment>{$ctx:openEnrollment}</openEnrollment> <selfEnrollment>{$ctx:selfEnrollment}</selfEnrollment> <restrictEnrollmentsToCourseDates>{$ctx:restrictEnrollmentsToCourseDates}</restrictEnrollmentsToCourseDates> <termId>{$ctx:termId}</termId> <sisCourseId>{$ctx:sisCourseId}</sisCourseId> <integrationId>{$ctx:integrationId}</integrationId> <hideFinalGrades>{$ctx:hideFinalGrades}</hideFinalGrades> <applyAssignmentGroupWeights>{$ctx:applyAssignmentGroupWeights}</applyAssignmentGroupWeights> <gradingStandardId>{$ctx:gradingStandardId}</gradingStandardId> <syllabusBody>{$ctx:syllabusBody}</syllabusBody> <enrollMe>{$ctx:enrollMe}</enrollMe> <offer>{$ctx:offer}</offer> </canvas.createCourse> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>