0
# Course Management
1
2
Comprehensive course operations including content creation, enrollment management, assignments, modules, and course administration. The Course class provides access to all course-related functionality within Canvas.
3
4
## Capabilities
5
6
### Course Information and Settings
7
8
Manage basic course information, settings, and metadata.
9
10
```python { .api }
11
class Course(CanvasObject):
12
def edit(self, **kwargs) -> Course:
13
"""
14
Edit course details.
15
16
Parameters can include:
17
- name: Course name
18
- course_code: Course code
19
- start_at: Course start date
20
- end_at: Course end date
21
- description: Course description
22
23
Returns:
24
Updated Course object
25
"""
26
27
def delete(self, **kwargs) -> Course:
28
"""Delete the course."""
29
30
def conclude(self, **kwargs) -> Course:
31
"""Conclude the course."""
32
33
def get_settings(self, **kwargs) -> dict:
34
"""Get course settings."""
35
36
def update_settings(self, **kwargs) -> dict:
37
"""Update course settings."""
38
```
39
40
### User and Enrollment Management
41
42
Manage course enrollments, user access, and enrollment types.
43
44
```python { .api }
45
def get_users(self, **kwargs) -> PaginatedList[User]:
46
"""
47
List users in the course.
48
49
Parameters:
50
- enrollment_type: Filter by enrollment type ('student', 'teacher', 'ta', etc.)
51
- include: Additional data to include ('enrollments', 'avatar_url', etc.)
52
53
Returns:
54
Paginated list of User objects
55
"""
56
57
def enroll_user(self, user, enrollment_type: str, **kwargs) -> Enrollment:
58
"""
59
Enroll a user in the course.
60
61
Parameters:
62
- user: User object or user ID
63
- enrollment_type: Type of enrollment ('student', 'teacher', 'ta', 'observer', 'designer')
64
- enrollment_state: State of enrollment ('active', 'invited', 'inactive')
65
- notify: Whether to send notification (default: True)
66
67
Returns:
68
Enrollment object
69
"""
70
71
def get_enrollments(self, **kwargs) -> PaginatedList[Enrollment]:
72
"""
73
List enrollments for this course.
74
75
Parameters:
76
- type: Filter by enrollment type
77
- state: Filter by enrollment state
78
- include: Additional data to include
79
80
Returns:
81
Paginated list of Enrollment objects
82
"""
83
84
def get_recent_students(self, **kwargs) -> PaginatedList[User]:
85
"""Get users who have recently been students in this course."""
86
```
87
88
### Assignment Management
89
90
Create, manage, and organize course assignments and assignment groups.
91
92
```python { .api }
93
def get_assignments(self, **kwargs) -> PaginatedList[Assignment]:
94
"""
95
List assignments for the course.
96
97
Parameters:
98
- include: Additional data ('submission', 'assignment_visibility', etc.)
99
- search_term: Search term to filter assignments
100
- order_by: Order assignments by field
101
102
Returns:
103
Paginated list of Assignment objects
104
"""
105
106
def create_assignment(self, assignment: dict, **kwargs) -> Assignment:
107
"""
108
Create a new assignment.
109
110
Parameters:
111
- assignment: Dictionary with assignment attributes:
112
- name: Assignment name (required)
113
- description: Assignment description
114
- due_at: Due date (ISO 8601 format)
115
- points_possible: Maximum points
116
- submission_types: List of allowed submission types
117
- grading_type: Grading type ('pass_fail', 'percent', 'letter_grade', 'gpa_scale', 'points')
118
119
Returns:
120
Assignment object
121
"""
122
123
def get_assignment(self, assignment, **kwargs) -> Assignment:
124
"""Get a single assignment by ID."""
125
126
def get_assignment_groups(self, **kwargs) -> PaginatedList[AssignmentGroup]:
127
"""List assignment groups for the course."""
128
129
def create_assignment_group(self, **kwargs) -> AssignmentGroup:
130
"""
131
Create a new assignment group.
132
133
Parameters:
134
- name: Assignment group name
135
- weight: Weight for weighted grading
136
- drop_lowest: Number of lowest scores to drop
137
- drop_highest: Number of highest scores to drop
138
139
Returns:
140
AssignmentGroup object
141
"""
142
```
143
144
### Module Management
145
146
Organize course content into modules with sequential access control.
147
148
```python { .api }
149
def get_modules(self, **kwargs) -> PaginatedList[Module]:
150
"""
151
List modules for the course.
152
153
Parameters:
154
- include: Additional data ('items', 'content_details')
155
- search_term: Search term to filter modules
156
157
Returns:
158
Paginated list of Module objects
159
"""
160
161
def create_module(self, module: dict, **kwargs) -> Module:
162
"""
163
Create a new module.
164
165
Parameters:
166
- module: Dictionary with module attributes:
167
- name: Module name (required)
168
- unlock_at: Date when module becomes available
169
- position: Position in module list
170
- require_sequential_progress: Whether items must be completed sequentially
171
- prerequisite_module_ids: List of prerequisite module IDs
172
173
Returns:
174
Module object
175
"""
176
177
def get_module(self, module, **kwargs) -> Module:
178
"""Get a single module by ID."""
179
```
180
181
### Content Management
182
183
Manage pages, files, folders, and other course content.
184
185
```python { .api }
186
def get_pages(self, **kwargs) -> PaginatedList[Page]:
187
"""
188
List pages for the course.
189
190
Parameters:
191
- sort: Sort pages by field ('title', 'created_at', 'updated_at')
192
- order: Sort order ('asc', 'desc')
193
- search_term: Search term to filter pages
194
195
Returns:
196
Paginated list of Page objects
197
"""
198
199
def create_page(self, page: dict, **kwargs) -> Page:
200
"""
201
Create a new page.
202
203
Parameters:
204
- page: Dictionary with page attributes:
205
- title: Page title
206
- body: Page content (HTML)
207
- published: Whether page is published
208
- front_page: Whether this is the front page
209
210
Returns:
211
Page object
212
"""
213
214
def get_files(self, **kwargs) -> PaginatedList[File]:
215
"""List files for the course."""
216
217
def get_folders(self, **kwargs) -> PaginatedList[Folder]:
218
"""List folders for the course."""
219
220
def create_folder(self, name: str, **kwargs) -> Folder:
221
"""
222
Create a new folder.
223
224
Parameters:
225
- name: Folder name
226
- parent_folder_id: Parent folder ID
227
- locked: Whether folder is locked
228
229
Returns:
230
Folder object
231
"""
232
```
233
234
### Discussion Management
235
236
Create and manage discussion topics and forums.
237
238
```python { .api }
239
def get_discussion_topics(self, **kwargs) -> PaginatedList[DiscussionTopic]:
240
"""
241
List discussion topics for the course.
242
243
Parameters:
244
- include: Additional data ('all_dates', 'sections', 'overrides')
245
- order_by: Order by field ('position', 'recent_activity', 'title')
246
- scope: Filter discussions ('locked', 'unlocked', 'pinned', 'unpinned')
247
248
Returns:
249
Paginated list of DiscussionTopic objects
250
"""
251
252
def create_discussion_topic(self, **kwargs) -> DiscussionTopic:
253
"""
254
Create a new discussion topic.
255
256
Parameters:
257
- title: Discussion title
258
- message: Discussion message/prompt
259
- discussion_type: Type of discussion ('side_comment', 'threaded')
260
- published: Whether discussion is published
261
- delayed_post_at: When to automatically publish
262
- lock_at: When to automatically lock discussion
263
264
Returns:
265
DiscussionTopic object
266
"""
267
```
268
269
### Quiz Management
270
271
Create and manage quizzes and assessments.
272
273
```python { .api }
274
def get_quizzes(self, **kwargs) -> PaginatedList[Quiz]:
275
"""
276
List quizzes for the course.
277
278
Parameters:
279
- search_term: Search term to filter quizzes
280
- include: Additional data ('assignment', 'overrides', 'all_dates')
281
282
Returns:
283
Paginated list of Quiz objects
284
"""
285
286
def create_quiz(self, quiz: dict, **kwargs) -> Quiz:
287
"""
288
Create a new quiz.
289
290
Parameters:
291
- quiz: Dictionary with quiz attributes:
292
- title: Quiz title (required)
293
- description: Quiz description
294
- due_at: Due date
295
- points_possible: Maximum points
296
- time_limit: Time limit in minutes
297
- allowed_attempts: Number of allowed attempts
298
- quiz_type: Type ('practice_quiz', 'assignment', 'graded_survey', 'survey')
299
300
Returns:
301
Quiz object
302
"""
303
304
def create_new_quiz(self, **kwargs) -> NewQuiz:
305
"""Create a new quiz using New Quizzes (Quizzes.Next)."""
306
```
307
308
### Grading and Gradebook
309
310
Manage grades, grading standards, and gradebook operations.
311
312
```python { .api }
313
def get_gradebook_history(self, **kwargs) -> PaginatedList[dict]:
314
"""Get gradebook history for the course."""
315
316
def add_grading_standards(self, **kwargs) -> GradingStandard:
317
"""Add grading standards to the course."""
318
319
def create_late_policy(self, **kwargs) -> dict:
320
"""
321
Create a late policy for the course.
322
323
Parameters:
324
- late_policy: Dictionary with policy attributes:
325
- missing_submission_deduction_enabled: Whether to deduct for missing submissions
326
- missing_submission_deduction: Percentage to deduct
327
- late_submission_deduction_enabled: Whether to deduct for late submissions
328
- late_submission_deduction: Percentage to deduct per period
329
- late_submission_interval: Deduction interval
330
331
Returns:
332
Late policy dictionary
333
"""
334
335
def get_custom_gradebook_columns(self, **kwargs) -> PaginatedList[CustomGradebookColumn]:
336
"""List custom gradebook columns."""
337
338
def create_custom_gradebook_column(self, column: dict, **kwargs) -> CustomGradebookColumn:
339
"""Create a custom gradebook column."""
340
```
341
342
### Section Management
343
344
Manage course sections and section-specific settings.
345
346
```python { .api }
347
def get_sections(self, **kwargs) -> PaginatedList[Section]:
348
"""
349
List sections for the course.
350
351
Parameters:
352
- include: Additional data ('students', 'avatar_url', 'enrollments')
353
354
Returns:
355
Paginated list of Section objects
356
"""
357
358
def create_course_section(self, **kwargs) -> Section:
359
"""
360
Create a new course section.
361
362
Parameters:
363
- name: Section name
364
- sis_section_id: SIS section ID
365
- start_at: Section start date
366
- end_at: Section end date
367
368
Returns:
369
Section object
370
"""
371
```
372
373
### External Tools
374
375
Manage external tools and LTI integrations.
376
377
```python { .api }
378
def get_external_tools(self, **kwargs) -> PaginatedList[ExternalTool]:
379
"""List external tools for the course."""
380
381
def create_external_tool(self, **kwargs) -> ExternalTool:
382
"""
383
Create an external tool.
384
385
Parameters:
386
- name: Tool name
387
- privacy_level: Privacy level ('anonymous', 'name_only', 'public')
388
- consumer_key: OAuth consumer key
389
- shared_secret: OAuth shared secret
390
- url: Tool launch URL
391
- domain: Tool domain
392
393
Returns:
394
ExternalTool object
395
"""
396
```
397
398
### Outcomes Management
399
400
Manage learning outcomes for the course.
401
402
```python { .api }
403
def get_outcome_groups_in_context(self, **kwargs) -> PaginatedList[OutcomeGroup]:
404
"""List all outcome groups for the course."""
405
406
def get_root_outcome_group(self, **kwargs) -> OutcomeGroup:
407
"""Get the root outcome group for the course."""
408
409
def get_outcome_group(self, group, **kwargs) -> OutcomeGroup:
410
"""Get details of a specific outcome group."""
411
412
def get_all_outcome_links_in_context(self, **kwargs) -> PaginatedList[OutcomeLink]:
413
"""Get all outcome links for the course."""
414
415
def get_outcome_results(self, **kwargs) -> PaginatedList[OutcomeResult]:
416
"""Get all outcome results for the course."""
417
418
def get_outcome_result_rollups(self, **kwargs) -> dict:
419
"""Get all outcome result rollups for the course."""
420
```
421
422
### Rubrics Management
423
424
Create and manage rubrics for assessments.
425
426
```python { .api }
427
def create_rubric(self, **kwargs) -> dict:
428
"""Create a new rubric for the course."""
429
430
def get_rubric(self, rubric_id, **kwargs) -> Rubric:
431
"""Get a single rubric by ID."""
432
433
def get_rubrics(self, **kwargs) -> PaginatedList[Rubric]:
434
"""List active rubrics for the course."""
435
436
def create_rubric_association(self, **kwargs) -> RubricAssociation:
437
"""Create a new rubric association."""
438
```
439
440
### Blueprints and Templates
441
442
Manage blueprint courses and templates.
443
444
```python { .api }
445
def get_blueprint(self, template: str = "default", **kwargs) -> BlueprintTemplate:
446
"""Get a blueprint template by ID."""
447
448
def list_blueprint_subscriptions(self, **kwargs) -> PaginatedList[BlueprintSubscription]:
449
"""List blueprint subscriptions for the course."""
450
```
451
452
### Late Policy Management
453
454
Configure late submission policies.
455
456
```python { .api }
457
def create_late_policy(self, **kwargs) -> LatePolicy:
458
"""Create a late policy for the course."""
459
460
def get_late_policy(self, **kwargs) -> LatePolicy:
461
"""Get the course late policy."""
462
463
def edit_late_policy(self, **kwargs) -> bool:
464
"""Update the course late policy."""
465
```
466
467
### Grading Standards
468
469
Manage custom grading standards.
470
471
```python { .api }
472
def add_grading_standards(self, title: str, grading_scheme_entry: list, **kwargs) -> GradingStandard:
473
"""Create a new grading standard for the course."""
474
475
def get_grading_standards(self, **kwargs) -> PaginatedList[GradingStandard]:
476
"""List available grading standards."""
477
478
def get_single_grading_standard(self, grading_standard_id, **kwargs) -> GradingStandard:
479
"""Get a single grading standard."""
480
```
481
482
### Analytics and Reporting
483
484
Access course analytics and participation data.
485
486
```python { .api }
487
def get_course_level_participation_data(self, **kwargs) -> list:
488
"""Get course-level participation data."""
489
490
def get_course_level_assignment_data(self, **kwargs) -> list:
491
"""Get course-level assignment data."""
492
493
def get_student_summaries(self, **kwargs) -> PaginatedList[dict]:
494
"""Get student summary data for analytics."""
495
496
def get_course_level_student_summary_data(self, **kwargs) -> PaginatedList[CourseStudentSummary]:
497
"""Get per-user access information for all students."""
498
499
def get_user_in_a_course_level_assignment_data(self, user, **kwargs) -> dict:
500
"""Get assignment data for a specific user."""
501
502
def get_user_in_a_course_level_participation_data(self, user, **kwargs) -> dict:
503
"""Get page views and participation for a specific user."""
504
505
def get_user_in_a_course_level_messaging_data(self, user, **kwargs) -> dict:
506
"""Get messaging hits for a specific user."""
507
```
508
509
## Usage Examples
510
511
### Creating a Complete Course Setup
512
513
```python
514
from canvasapi import Canvas
515
516
canvas = Canvas("https://canvas.example.com", "your-token")
517
course = canvas.get_course(12345)
518
519
# Create assignment groups
520
hw_group = course.create_assignment_group(
521
name="Homework",
522
weight=40
523
)
524
525
exam_group = course.create_assignment_group(
526
name="Exams",
527
weight=60
528
)
529
530
# Create assignments
531
assignment = course.create_assignment({
532
'name': 'Assignment 1',
533
'description': 'Complete the reading and answer questions',
534
'due_at': '2024-12-01T23:59:59Z',
535
'points_possible': 100,
536
'submission_types': ['online_text_entry', 'online_upload'],
537
'assignment_group_id': hw_group.id
538
})
539
540
# Create a module
541
module = course.create_module({
542
'name': 'Week 1: Introduction',
543
'unlock_at': '2024-11-01T00:00:00Z',
544
'require_sequential_progress': True
545
})
546
```
547
548
### Enrollment Management
549
550
```python
551
# Enroll students in the course
552
student_ids = [123, 456, 789]
553
for student_id in student_ids:
554
enrollment = course.enroll_user(
555
user=student_id,
556
enrollment_type='student',
557
enrollment_state='active',
558
notify=True
559
)
560
print(f"Enrolled user {student_id}: {enrollment.id}")
561
562
# Get all students in the course
563
students = course.get_users(enrollment_type='student')
564
for student in students:
565
print(f"Student: {student.name} ({student.email})")
566
```
567
568
### Content Creation
569
570
```python
571
# Create a course page
572
page = course.create_page({
573
'title': 'Course Syllabus',
574
'body': '<h1>Welcome to the Course</h1><p>Course description...</p>',
575
'published': True,
576
'front_page': True
577
})
578
579
# Create a discussion topic
580
discussion = course.create_discussion_topic(
581
title="Week 1 Discussion",
582
message="Please introduce yourself and share your goals for this course.",
583
discussion_type='threaded',
584
published=True
585
)
586
587
# Create a quiz
588
quiz = course.create_quiz({
589
'title': 'Week 1 Quiz',
590
'description': 'Quiz covering week 1 material',
591
'quiz_type': 'assignment',
592
'points_possible': 50,
593
'time_limit': 30,
594
'allowed_attempts': 2,
595
'due_at': '2024-12-01T23:59:59Z'
596
})
597
```