Skip to main content

Canvas API

Example API URLS:

Show all items (pages, quizes, assignemnts, ....) from a module.

https://.../api/v1/courses/3237/modules/19631/items 

Show assignment 110611 from course 7760
Include user- en submission information *see parameters)

https://.../api/v1/courses/7760/assignments/110611/submissions?include[]=submission_comments&include[]=user 

Zelfde maar nu alleen van user 61196

https://.../api/v1/courses/7760/assignments/131589/submissions/61196?include[]=submission_comments&include[]=user


Boiler Plate for rating a submission with Python

from canvasapi import Canvas

course = canvas.get_course(course_id)
assignment = course.get_assignment(assignment_id)

submissions = assignment.get_submissions(include=["user", "submission_comments"])

for submission in submissions:
  # create code to search for the right submission (don't know how to select one directly...?
  if ( submission.id == ....):
    this_attempt = submission.attempt
    submission.edit(submission={"posted_grade": str(10)})
    submission.edit(comment={"text_comment": 'Well done!', "attempt": this_attempt})

Show assignment 110611 from course 7760
Include user- en submission information *see parameters)

https://.../api/v1/courses/7760/assignments/110611/submissions?include[]=submission_comments&include[]=user xxx

Zelfde maar nu alleen van user 61196

https://.../api/v1/courses/7760/assignments/131589/submissions/61196?include[]=submission_comments&include[]=user

 

Boiler plate Python