I want to design a REST API two resources, users and groups. A user can join multiple groups and a group can have multiple users.
Let's assume you can access related resources via /users/:id/groups and /groups/:id/users. How would you design the enpoints for joining/leaving a group? I could do
POST /users/:id/groups/:id and DELETE /users/:id/groups/:id
but I could also go for
PATCH /users/:id/groups/:id and send a boolean.
Of course I don't need those endpoints for groups because they are redundant, this should be obvious. I'm not sure if this is a opinion based question, but what is the common way to deal with such relationships?