REST is a Resource-Oriented. URLs represent resources.
In your example, /users/123/comments
:
users
is a resource.123
is the unique identifier of an user.- In this case, comments are a sub-resource of users, but they are probably resources on their own (ex. calling
/comments/{id}
)
About your second question, the format for /me/purchases
is not the same as /users/123
. And /me/purchases
is probably a short URL for something like /users/{myid}/purchases
where purchases
are a sub-resource of users (and probably a resource on their own also, available by /purchases/{id}
).
For more information, here is a video, that is not directly related to your question, but that is very well made and very interesting about REST web services.