Basically, one feature of my app is to retrieve the logged user's friends.
Actually, I hesitate between both kind of endpoints:
- GET /api/users/friends
- GET /api/users/:userId/friends
userId would be reachable through the authentication token.
Using 2, server would have to additionally check for the correspondance between the passed
userId, and the logged user id specified in the auth token so that it avoids any malicious access to other user data, like friends.
So 1 should be enough, but it doesn't sound like a standard rest url.
What is a good practice?