Another API question

637 views
Skip to first unread message

jared...@gmail.com

unread,
Jun 26, 2013, 8:00:08 AM6/26/13
to canvas-l...@googlegroups.com
At the hackathon, Cody tipped me off that the information I needed was contained in the submission API.

However, I can't seem to get the syntax correct. Here is what I put in (edited for security):


The reply I get is:

{"status":"unauthorized","errors":{"message":"user not authorized to perform that action"}}

I have tried sending this both as the instructor and as the student users and get the same result. Any suggestions on how to get this to work?

Brian Palmer

unread,
Jun 26, 2013, 10:46:49 AM6/26/13
to canvas-l...@googlegroups.com
Hi Jared, I'm not sure this is what's causing your unauthorized error, but here's the correct syntax:

https://uvu.instructure.com/api/v1/courses/232699/students/submissions?access_token=notmyrealtoken&student_ids[]=1228232&grouped=true&include[]=total_scores

Note the literal names of the params are "include[]" and "student_ids[]" as listed in the docs, it's a little funky but it's the Ruby on Rails convention for array params. We'd like to add a more natural syntax at some point.

-- Brian



--
 
---
You received this message because you are subscribed to the Google Groups "Canvas LMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to canvas-lms-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

jared...@gmail.com

unread,
Jun 26, 2013, 12:46:34 PM6/26/13
to canvas-l...@googlegroups.com
Thanks Brian,

I updated my syntax, but I get the same error. Any other ideas?

This is what I am using now

Cody Cutrer

unread,
Jun 26, 2013, 12:47:31 PM6/26/13
to canvas-l...@googlegroups.com
Jared,

Is the access token you're using for the teacher, or the student? I don't think students have permission to pull their own submissions (yet).

Cody Cutrer
Software Engineer
Instructure

jared...@gmail.com

unread,
Jun 26, 2013, 5:08:30 PM6/26/13
to canvas-l...@googlegroups.com
Hmm. If you remember my gamification dashboard, it will need to be a student token. They are the one's logged in when they are seeing the interface. Would you mind doing some checking and confirming whether or not they have permission from their log in to see their submissions?

If not, is there anything that can be done to give them permission?

I'll also do some tests to see if I can do it with a teacher token.

Cody Cutrer

unread,
Jun 26, 2013, 5:40:50 PM6/26/13
to canvas-l...@googlegroups.com

jared...@gmail.com

unread,
Jun 27, 2013, 9:30:07 PM6/27/13
to canvas-l...@googlegroups.com
Thanks Cody,

I'll make some changes, I appreciate your help!

jared...@gmail.com

unread,
Jun 28, 2013, 10:27:35 AM6/28/13
to canvas-l...@googlegroups.com, jared...@gmail.com
Does the instructor token have permission to the for_students method?

I still get the same error using an instructor token


I also tried the show method with the student token and got this error


{"status":"not_found","error_report_id":46579959,"message":"The specified resource does not exist."}

I'm not sure what the correct id is for assignment, I assumed that it was the assignment id returned by the assignment api.

Is there any way for me to pull all of the submission data for my class as the instructor?

Cody Cutrer

unread,
Jun 28, 2013, 11:08:58 AM6/28/13
to canvas-l...@googlegroups.com, Jared Chapman
Jared,

A couple of things. First, you change the access tokens in the text of your e-mail, but not in the links. I've revoked the three access tokens that were exposed in this thread.

Second, the calls you have made above are correct, but apparently they do not work with the Student View user. I'm not sure if this is intentional or not. You should probably file a ticket at help.instructure.com for that.

Third, yes, the id for the assignment is the assignment id. And the "submission id" in the student call is actually the user's id. Or "self" to mean the user associated with the access token you are using.

Cody Cutrer
Software Engineer
Instructure

jared...@gmail.com

unread,
Jun 29, 2013, 4:28:04 PM6/29/13
to canvas-l...@googlegroups.com
What is the syntax for including multiple student ids in that request?


On Wednesday, June 26, 2013 8:46:49 AM UTC-6, Brian Palmer wrote:

Cody Cutrer

unread,
Jun 29, 2013, 4:40:26 PM6/29/13
to canvas-l...@googlegroups.com
submissions?student_ids[]=1&student_ids=2

Cody Cutrer
Software Engineer
Instructure

jared...@gmail.com

unread,
Jun 29, 2013, 7:47:04 PM6/29/13
to canvas-l...@googlegroups.com
Great, thanks!

Brian Palmer

unread,
Jun 30, 2013, 3:36:11 PM6/30/13
to canvas-l...@googlegroups.com
Whoops there's a typo there, the key is the same each time it is repeated.

submissions?student_ids[]=1&student_ids[]=2

(note there's brackets after the second key too)

-- Brian


Reply all
Reply to author
Forward
0 new messages