...
...
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 details
This section provides further details on the operations related to courses.
Creating a courseThe createCourse operation creates a new course for the teacher.
Code Block |
---|
language | xml |
---|
title | createCourse |
---|
|
<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
accountId:
The ID of the Canvas admin account to which the course belongs.name:
The name of the course. If omitted, the course is named "Unnamed Course".code:
The course code.startAt:
The course start date in the ISO8601 format, e.g., 2011-01-01T01:00Z.endAt:
The course end date in the ISO8601 format, e.g., 2011-01-01T01:00Z.license:
The name of the licensing used when publishing the course.isPublic:
Whether the course is public or private in Canvas.publicSyllabus:
Sets to "true" to make the course syllabus public.publicDescription:
A publicly visible description of the course.allowStudentWikiEdits:
If "true", allows students to modify the course wiki.allowWikiComments:
If "true", allows course members to comment on wiki pages.allowStudentForumAttachments:
If "true", allows students to attach files to forum posts.openEnrollment:
Set to "true" if the course is "open enrollment".selfEnrollment:
Set to "true" if the course is "self enrollment".restrictEnrollmentsToCourseDates:
Set to "true" to restrict user enrollments to the start and end dates of the course.termId:
The unique ID of the term to create a course.sisCourseId:
The unique SIS identifier.integrationId:
The unique integration identifier.hideFinalGrades:
If set to "true", hides the totals in the student grades summary.applyAssignmentGroupWeights:
Set to "true" to weight final grade based on assignment groups percentages.gradingStandardId:
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.syllabusBody:
The syllabus body for the course.enrollMe:
Set to "true" to enroll the current user as the teacher.offer:
If set to "true", makes the course available to students immediately.
Sample requestFollowing is a sample REST/JSON request that can be handled by the createCourse
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for createCourse |
---|
|
{
"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
} |
https://canvas.instructure.com/doc/api/courses.html#method.courses.create
Retrieving a course The getCourse operation retrieves a course by ID.
Code Block |
---|
language | xml |
---|
title | getCourse |
---|
|
<canvas.getCourse>
<accountId>{$ctx:accountId}</accountId>
<courseId>{$ctx:courseId}</courseId>
<include>{$ctx:include}</include>
</canvas.getCourse> |
Properties
accountId:
The ID of the Canvas admin account to which the course belongs.courseId:
The ID of the course whose users should be listed.include:
Includes optional details of the course that is being retrieved.
Sample request
Following is a sample REST/JSON request that can be handled by the getCourse operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for getCourse |
---|
|
{
"accountId": "81259",
"accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO",
"apiUrl": "https://canvas.instructure.com",
"courseId": "893240",
"include": "all_courses,permissions"
} |
https://canvas.instructure.com/doc/api/courses.html#method.courses.show
Anchor |
---|
| getCourseUser |
---|
| getCourseUser |
---|
|
Retrieving a user belonging to a course The getCourseUser
operation retrieves a user belonging to a course by ID.
Code Block |
---|
language | xml |
---|
title | getCourseUser |
---|
|
<canvas.getCourseUser>
<courseId>{$ctx:courseId}</courseId>
<userId>{$ctx:userId}</userId>
</canvas.getCourseUser> |
Properties
courseId:
The ID of the course whose user should be retrieved.userId:
The ID of the user to be retrieved.
Sample request
Following is a sample REST/JSON request that can be handled by the getCourseUser
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for getCourseUser |
---|
|
{
"accessToken": "7~UnsR6KCrYoap7KyAYMfNvANQeD59OinOIRp0S82FU7z1o5dz7o0VIBqNl6afoVBO",
"userId": "4213615",
"apiUrl": "https://canvas.instructure.com",
"courseId": "897098"
} |
https://canvas.instructure.com/doc/api/courses.html#method.courses.user
Retrieving courses The listCourses
operation retrieves a list of active courses for the current user.
Code Block |
---|
language | xml |
---|
title | 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
enrollmentType:
When set, only return courses where the user is enrolled as this type. This argument is ignored if enrollment_role is given.enrollmentRole:
When set, only return courses where the user is enrolled with the specified course-level role.include:
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.state:
State(s) of the courses to be listed.perPage:
The number of results to return per page. For more information on pagination, see https://canvas.instructure.com/doc/api/file.pagination.html.page:
Number of the page to return.
Sample request
Following is a sample REST/JSON request that can be handled by the listCourses
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for 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"
} |
https://canvas.instructure.com/doc/api/courses.html#method.courses.index
Anchor |
---|
| listCourseUsers |
---|
| listCourseUsers |
---|
|
Retrieving all users The listCourseUsers
operation retrieves all users belonging to a course.
Code Block |
---|
language | xml |
---|
title | 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
searchTerm:
The partial name or full ID of the users to match and return in the results list.userId:
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.enrollmentType:
When set, only returns users where the user is enrolled as this type. This argument is ignored if enrollment_role is given.enrollmentRole:
When set, only returns users enrolled with the specified course-level role.include:
Includes optional details of each user being listed.page:
The number of the page to return. For more information on pagination, see https://canvas.instructure.com/doc/api/file.pagination.html.
perPage:
The number of results to return per page.courseId:
The ID of the course whose users should be listed.
Sample request
Following is a sample REST/JSON request that can be handled by the listCourseUsers
operation.
Code Block |
---|
language | xml |
---|
title | Sample Request for 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"
} |
https://canvas.instructure.com/doc/api/courses.html#method.courses.users
Enrolling a user The enrollUser
operation enrolls a user for a course in Canvas.
Code Block |
---|
language | xml |
---|
title | 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
courseSectionId:
The ID of the course section to enroll the student to.limitPrivilegesToCourseSection:
If a teacher or TA enrollment, restricts the teacher/TA to the section given by course_section_id.enrollmentState:
If set to "active", immediately enrolls the student to the course. Otherwise, the student will be required to accept a course invitation. Default: "invited".selfEnrollmentCode:
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.enrollmentRole:
Assigns a custom course-level role to the user.enrollmentType:
Enrolls the user as a student, teacher, TA, observer, or designer.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.
Code Block |
---|
language | xml |
---|
title | Sample Request for enrollUser |
---|
|
{
"apiUrl":"https://orion-city.acme.instructure.com",
"accessToken":"51451~fwK08jirhrTKFiuyua8H3rpFVQtZJu7D7rf3mi7pecuHxMglbY24XOxQ42UWTvam",
"courseSectionId":"",
"limitPrivilegesToCourseSection":true,
"enrollmentState":"",
"selfEnrollmentCode":"",
"enrollmentRole":"",
"enrollmentType":"StudentEnrollment",
"courseId":"96",
"userId":"14",
"notify":true
} |
https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.create
Anchor |
---|
| sampleconfiguration |
---|
| sampleconfiguration |
---|
|
Sample configurationFollowing 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.
...