Refactor templates for different access areas: authn, not-authn, my auctions, all auctions…
Resource:
Topics
Functions
Resources:
think it all depends on semantics and intentions. It seems like you're talking about a protected resource, not a publicly available one. In this case your communication is more explicit and has the least amount of surprise when a more verbose format is used:
http://api.gallery.com/users/{user-id}/images/{image-id}
If it's a public resource then it can be identified by image-id only and then the shorter format would be more logical:
http://api.gallery.com/images/{image-id}
share|edit|flag
answered Feb 7 '12 at 0:32
Yuriy Zubarev
1,868613
add comment
up vote 1 down vote
I think that the second is more RESTful for the reason you state. The URL is a hierarchy. The user-id is not really part of the identification of the image, so why make it part of the identifier?
Make an /users/{user-id}/images resource that returns a list of URLs in the form /images/{image-id} to list the images that the user has uploaded, and you have the best of both worlds.