Canvas API 404 error when getting users from a group_id

Jump to solution
quantumblink
Community Member

I am a TA in a course looking to develop some scripts using Python (but am currently building the endpoint in Postman for testing). My goal is to retrieve the users in a course's group, as we use groups on a course to sort students into graders.

I have been able to retrieve a list of Group objects with the endpoint

https://myinstitution.instructure.com/api/v1/courses/123456/groups

where 123456 is the course ID.

From there, I manually retrieved the group IDs offered from the JSON response to try getting users as per the standard at https://canvas.instructure.com/doc/api/groups.html#method.groups.users.

https://myinstitution.instructure.com/api/v1/courses/123456/groups/234567/users

where 234567 is a group ID.

Is there somewhere I'm going wrong?

 

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

Hi @quantumblink,

When looking at the groups doc, it seems that you do not need the "courses/123456/" part in the URL when trying to get the list of group users.  Groups in Canvas are somewhat weird in that they are somewhat loosely attached to a course through those IDs, but kind of also exist outside of the course structure of Canvas as well.  This is a case where you can just reference the group id itself.  Hope this makes sense and gets your code working!

-Chris

View solution in original post