This script cover API calls which helps TAs do score submission on Canvas.
Before using the script, you will need Canvas access token, course ID, assignment ID and student ID.
-
Go to canvas, click left side bannar and go to your account setting.
-
In integration part, click "New Access Token" to add a new token. Type a label for it, and set a expiration date. Be careful: it is not recommended to set token a long time. You may increase the token leaking danger. The best way is, when you need one, you generate one for single day only.
-
Copy the token, you will need it for the API calls. Caution: do not share it to anyone or spread it in public.
Query every course by API with your token, you can find the course id you want.
//change the URL to your instructure's endpoint
$ curl -H 'Authorization: Bearer YOUR_TOKEN' https://gatech.instructure.com/api/v1/courses/
Or, you can use Chrome ARC
Find the course you want, the id
in the same JSON object is the course id. Copy it, you will need it.
Similar to how you get course id, fire following command to get all assignments under that course:
$ curl -H 'Authorization: Bearer YOUR_TOKEN' https://gatech.instructure.com/api/v1/courses/COURSE_ID/assignments
Same, find the assignment you want, and record down the assignment id.
It is also workable to use Chrome ARC, but passed it here.
You would need student id for putting their scores.
$ curl -H 'Authorization: Bearer YOUR_TOKEN' https://gatech.instructure.com/api/v1/courses/COURSE_ID/students
Put the student id in the score sheet. (You may need other small script to help on that)
- Put access token, course ID, assignment ID and name of score sheet in the script
score_uploader.py
- Prepare your score sheet in CSV format with following content:
STUDENT_NAME,ID,SCORE
e.g.
Carol Hsu,10101,87
Nosus Hsu,55688,56
With a custom score sheet file, you should change the script.
- You can also send out comments at the same time
Add a new key-value pair with key called
"comment[text_comment]"
inparams
value in script.
other submission reference