Bulk Pairing Codes Google Sheet

kyle_cole
Instructure
Instructure
0
324

IMPORTANT DISCLAIMER: This is a homemade solution and is not Instructure supported.

Creating pairing codes can be done at the course and user level but sometimes as an admin you need to generate pairing codes on the fly. Using Google Apps script and the Canvas API you can generate those codes easily.  Before you use this make sure you have the ability to generate observer codes in your Canvas instance. If you have a larger student population and this does not work out for you, try the Python script listed below. It will produce the same result.

 

What does it do?

 

  • Fetch all users that have student enrollments: This will bring in the Canvas ID, Name, SIS ID, and Login Id of all users who have an enrollment status of student. 
  • Generate Pairing Codes: This will generate one pairing code per user and list the expiration time of that code.

 

*Tip: If you only want to add SIS IDs to a handful of users, run a provisioning report and copy the Canvas ID to the first column. You can also run the generate pairing codes function multiple times if you need more than one pairing code.

 

What you will need:

  • Instructure URL: Your .instructure URL, like canvas.instructure.com, is necessary for API calls. Retrieve it from your admin settings under Canvas Cloud Information. Although vanity URLs are an option, using the Instructure URL is recommended for API consistency.
  • API Token: Generate an API token with appropriate permissions. Admins can create API tokens using this guide: How do I manage API access tokens as an admin? 

 

Video:

Possible Issues:

  • Google has a rate limit of 300 requests per minute. If you run over that, it will error out. 
  • Google also has a per-day limit based on your subscription. If you run into that, you will have to wait it out. 
  • There is a 40k limit of rows so you will not be able to go over that. That means if you have over 40k users you need pairing codes for you will have to chunk them out.
  • There is a runtime of 6 minutes for non edu/coroporate accounts but if you are using a edu/coroporate account it has a 30 minute runtime limit.



Lastly, here is the link to the sheet and the code used to make this happen. If you have any questions or run into any issues, post in the comments below. 



Link to Google Sheet:  https://docs.google.com/spreadsheets/d/1T0TIVg3Obt9fR4fvej0Oi9Sz7rQ4yowywqcEsAN3xFc/copy

Links to Apps Script:
https://github.com/KyleCole90/Canvas-Scripts/blob/main/Apps%20Scripts/Bulk%20Pairing%20Codes.gs 


Python Script: https://github.com/KyleCole90/Canvas-Scripts/blob/main/Pairing%20Codes.py