Create API Endpoints to GET List of Users from User Group and vice versa
abrahmasandra opened this issue · 3 comments
Summary: The goal of this issue is to create an endpoint that will GET all of the groups that a given user is in. In addition, we want to create another endpoint that can GET all of the members of a given group. These endpoints will only support GET requests. They are clearly important, as an API user may want to get information relating Users
to Groups
We will support a GET
request to the endpoint: /api/users/<user_id>/groups
to get the groups from a given user. This endpoint allows us to specify the user through the user_id
, and then we can look up the groups of this user.
We will also support a GET
request to the endpoint: /api/groups/<group_id>/members
to get all the users/members of a given group. This endpoint allows us to specify the group through the group_id
, and then we can look up the members of the group.
We will know that this issue is completed when the GET requests to the URLs above is functional
Added support for username
slugs in addition to the user_id
for this endpoint: /api/users/<user_id>/groups
. Now supports /api/users/<username>/groups
Closing Comment:
Created 2 endpoints: /api/users/<user>/groups
(where user
can either be the user's id
or their username) as well as /api/groups/<group_id>/members
. Both endpoints only support GET
requests.
The first endpoint gets all of the groups that a given user
is in (user specified from id
or unique username
). The second endpoint gets all of the members (User
objects) within a given group (specified by the group_id
)
Issue Score: Excellent