Say I have the endpoints:
/users
and
/users/<id>
If I wanted to DELETE a user authenticated with a JWT token that contains the user object, should this DELETE handled go under /users
or /users/<id>
?
It makes sense to have under the /users/<id>
endpoint as you're deleting that specific item.
But also makes sense to have it under /users
as then you don't have redundant data and you don't have to enter the <id>
every time you want to perform a function on your user when you already have the JWT authentication.
This idea falls to many-to-many objects too, say I wanted to access /users/<id>/games/<id>/move
stripping '/users/<id>
' makes it seem like there's not 'user' resource but it makes it less clunky and again less data redundancy.
Which is more 'accepted' or 'right'? Thanks :)