Found this content helpful? Log in or sign up to leave a like!

Submissions API for student submission data as an Observer

Jump to solution
schaeje
Community Novice

I'm a parent working on a Python app to pull in my kids assignments and grades.  I'm using a token generated from my own account (as an Observer role).  

The Courses and Assignments endpoints have been fine, but I'm running into issues trying to work with Submissions.  When I formulate the call for a specific assignment, and only for my student, I get: 

API request failed: 404 Client Error: Not Found for url

I'm using the guidance from the docs, and formulating the request as below:

https://canvas.instructure.com/api/v1/courses/<course_id>/assignments/<assignment_id>/submissions/<my_students_user_id>

I've tested each segment with fine results up through assignment, but get the 404 after adding the submission for my student using her user_id.  

I can access any submission with no issue via the user portal, via urls like the following:

 https://<my_domain>.instructure.com/courses/<course_id>/assignments/<assignment_id>/submissions/<my_students_user_id>

What I'm wondering:

  • Does an observer somehow not have permissions? I'd gotten plenty of 403s when testing other routes, so I suspect this isn't the case, esp since I can access the submission via the end user portal. 
  • Is the API documentation incorrect or out of date? Again, I suspect not given the web portal URL structure very closely resembles the API request. 
  • Am I missing something small + stupid? This is my main theory, but there's just not a whole lot to mess up.   

Seems like this should be pretty straightforward - would appreciate any guidance!

Labels (1)
0 Likes
1 Solution
chriscas
Community Coach
Community Coach

Hi @schaeje,

I haven't really tested API calls acting as an observer, as we really don't even use the observer role in higher-ed, but there is one thing that sticks out to me in your post.  For the API call thats returning a 404, you have the domain as canvas.instructure.com whereas in the UI url that works, you have <my_domain>.instructure.com.  I'm not sure if those are just examples you made up to post here, but API cals should generally be made to something like <my_domain>.instructure.com, not canvas.instructure.com (unless canvas.instructure.com is the actual URL the course uses).

Let us know if changing the URL fixes the issue, or if it was just an example here...  I have a few other thoughts, but this is by far the easiest one to check/fix.  If this doesn't fix the problem, it would be great if you could post as much as possible of your code here (through a link or just pasting).  Sometimes an issue could be caused by a seemingly unrelated line of code pretty far away, so it helps to have more ode or even the entire thing so people here could run it and try to replicate the result.

Hope to hear back from you soon!

-Chris

View solution in original post

0 Likes