Assignment List and Details via API

Jump to solution
d_cutting
Community Novice

Hi,

Very new to Canvas so this could just be me being less-than-gifted but using the API, I have a course and wish to get a student list and also the assignments from it. I am an instructor for this course and using my access token.

The course ID within Canvas is 1117 and we have both a live and a test environment, all hosted by Instructure on AWS.

When I make the API call to courses/1117 I get the course object back no problem.

When I call courses/1117/users with the option to get students again it comes back fine as paginated JSON.

However - a call to courses/1117/assignments returns a block of HTML with the title "Page Not Found" (it does this in both our test and live environments).

In the web interface I can click on one of the assignments and see that it has the ID 8155 so I then tried requesting courses/1117/assignments/8155.

This time I get JSON back, on live it says "the specified resource does not exist" and on test "user authentication required" (I'm passing a valid token in the URI and the same one works for all the calls above).

So:

Am I being stupid or should courses/:course_id/assignments work?

Shouldn't it return a JSON error rather than an HTML error page if it didn't?

And can anyone shed any light on the differences in return from the test and live environments?

Many thanks in advance!

Dave

0 Likes
1 Solution

Thanks Jeffrey - really I should have tried the browser (doh!). When I did I got valid JSON so I dug into the test and turns out had a very old version of Postman and an errant & was appearing in the failing URIs when generated route&?x=y so no parameters were being passed.

Updated and working well now, slowly beginning my Canvas API journey.

Thanks!

View solution in original post