The API Song

Kenneth Larsen & Tyler Clair

About Us

Tyler Clair

  • Instructional Tools Administrator
  • Teaching & Learning Technologies
  • Utah State University
  • tyler.clair@usu.edu
  • @tylerclair

Kenneth Larsen

  • Programmer/Analyst
  • Teaching & Learning Technologies
  • Utah State University
  • kenneth.larsen@usu.edu
  • @duniken

API

Application Program Interface

Note:

  • All API access is over HTTPS, against your normal Canvas domain
  • All API responses are in JSON format

Why Use the Canvas API?

How have you used the Canvas API?

Syllabus Tracker

Syllabus Tracker

Canvas Usage Report

Proctored Exams

Bulk LTI Tool

USU Design Tools

SIS Import Tool

SIS Import Tool

Other Uses

  • Bulk Course Creation/Copying
  • Quiz IP Address Log
  • Mass User Enroll
  • ... etc ...

Accessing an API

1. While logged in to Canvas
Example: {canvas domain}/api/v1/users/self/
2. Programmatically

Canvas Instances
& Permissions

Canvas Instances

Test Canvas
usu.test.instructure.com
Resets every 3 weeks
Beta Canvas
usu.beta.instructure.com
Resets every week
Production Canvas
usu.instructure.com
Does not reset

Anatomy of a Canvas URL

Course

https://usu.test.instructure.com/courses/123456

Domain

https://usu.test.instructure.com/courses/123456

Course Identifier

https://usu.test.instructure.com/courses/123456

Course ID

https://usu.test.instructure.com/courses/123456

Assignment

... /courses/123456/assignments/12345

Note it is associated with a course

... /courses/123456/assignments/12345

Assignment Identifier

... /courses/123456/assignments/12345

Assignment ID

... /courses/123456/assignments/12345

Permissions

Oauth

Canvas Data

OAuth Token

Instances or Permissions Questions

Using the Canvas API

API Terminology

  • POST
  • GET
  • PUT
  • DELETE
  • Create
  • Read
  • Update
  • Delete

Generating an OAuth Token

Resources

Working with JSON

Chrome Extension
JSON Formatter
Firefox Add-on
JSONView

Pitfalls

Canvas

Canvas API Documentation
{canvas domain}/doc/api/

Postman

getpostman.com

Resources Questions

Time to Play

Courses

GET Get a Single Course

Canvas API Live
/api/v1/courses/{course_id}/

Enrollments

GET List Enrollments

Canvas API Live
/api/v1/courses/{course_id}/enrollments
/api/v1/sections/{section_id}/enrollments
/api/v1/users/{user_id}/enrollments

Assignments

GET List Assignments

Canvas API Live
/api/v1/courses/{course_id}/assignments

Analytics

GET

Canvas API Live

SIS IDs

/api/v1/courses/12345//api/v1/courses/sis_course_id:4321

  • sis_course_id
  • sis_login_id
  • sis_term_id
  • sis_user_id
  • sis_account_id
  • sis_section_id
  • sis_group_id

Other ID Alternatives

Users self Current User
Accounts self Root account for the current domain
  default Default account
  site_admin Site Admin account
Terms default The default term
  current Current term based on term start dates. Will not be found if terms overlap
https://canvas.instructure.com/doc/api/file.object_ids.html

Basic API Questions

Your Turn

Account Reports

  1. GET List Available Reports

    Identify report name and parameters

  2. POST Start a Report

    Grab the created report ID

  3. GET Status of a Report

    Pass in the name of the report and the ID from step 2

Final Questions