cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Advocate
Community Advocate

PRE-CON: API 101: Introduction to APIs

317606_pastedImage_9.png

 

Presentation Title

PRE-CON: API 101: Introduction to APIs

InstructureCon Session Info

 

Summary

The Canvas API is crazy powerful and can be used to perform a bunch of actions and automate otherwise mundane processes.

 

Details

I consider myself pretty tech savvy but I've never dabbled into APIs so I was very interested to learn more about the capabilities of the Canvas API. Prior to the session, participants had to download an API development app, Postman (free download).

Session Presenters

Deactivated user, Instructure Trainer
crowley@instructure.com, Technical Consultant

Why use an API?

  • When you need to make changes in bulk.

Examples of API Use:

  • Create a user
  • Give certain users admin rights
  • Change the course status to private
  • Turn on a feature flag for all the courses of a certain instructor
  • Merge 2 users

Example:

“Hey Siri, what time does Walmart Pharmacy open today?”

There are 4 parts of an API call:

  1. authorization
  2. options
  3. location
  4. action

Example in Canvas:

“Hey Canvas, tell me what users are enrolled in BIO 101 100M SU19?”

 

View the API features at your institution:

https://[institution.beta].instructure.com/api/v1/accounts/self/features
  • Must already be logged into institution Canvas instance, NOT the vanity URL (if your institution uses one)
  • Must have an Account Admin role (or sub-account role)
Only use the beta instance of your Canvas account until you are comfortable enough to make changes to the production environment. Making changes to the API has the potential to make very large and possibly destructive changes to your Canvas environment! - How do I access the Canvas beta environment as an admin? 

Methods:

  • Get (tell me something)
  • Post (create something new)
  • Put (update something that already exists)
  • Delete (remove from the UI)

What if you don’t know the course ID?

Canvas API Documentation: api.instructure.com

When using a GET API call, you’ve already authenticated in your browser.

When using POST, PUT, DELETE, you can’t use a browser so you need another way to authenticate using a TOKEN.

API Token Security Best Practices:

  • Don’t share it
  • Protect it
  • Have it expire

It’s better to create a separate token in Production, Test, & Beta Canvas instances.

Account > Settings > Generate New Token

Admin > Settings > Reports > Provisioning Report > Courses (only use a specific Term) > Run Report

Can use the Provisioning Report from above to get the unique course ID to replicate the same action on all courses.

canvas_course_id

Use double curly brackets in Postman app on the new value for the Path Variable:
{{canvas_course_id}}

Conclusion

This was probably one of my favorite sessions at InstructureCon 2019 and was an eye-opening view into the power behind the Canvas API. I have a few ideas for how I can apply what I learned into my daily tasks as a Canvas admin at my institution and I'm very thankful to have an opportunity to attend this pre-con!

By the end of this session, I was able to create a new Canvas course with the API, how exciting?! :smileycool:

I'm also looking forward to the video recording to be available so I can review it when I have questions.

What are some of the ways you are using the Canvas API in your day-to-day work? I'd love to learn more!

 

 

Blogs!

InstructureCon 2019

Read More Session Recap Blogs

Banner photo by Safar Safarov on Unsplash

3 Replies
Highlighted
Explorer III

Nice recap of a great InstCon session, gnordberg@lfcc.edu‌! I loved the live role-playing of different API calls. 

Highlighted

Very cool moulder@upenn.edu‌, thanks for sharing!

Highlighted
Community Advocate
Community Advocate

Assuming since this is Pre-Con there isn't a recording of this available...bc I would love to see this...even for a price!

Top Kudoed Authors
Labels