Reputation: 1891
Suppose I have two resoureces: carts and items. Items can be nested inside cart or can be not this way:
/carts/32658/items/screwdriver
/items/screwdriver
Does the same item in cart and not in cart are different resources in REST conventions?
Upvotes: 1
Views: 119
Reputation: 1316
As other answers and comments have suggested there is no REST violation when having multiple URI to one resource and different sources and SO answers say so.
Each resource in a service suite will have at least one URI identifying it.
But I would rethink if you allow all HTTP methods on the second resource link. Given /carts/32658/items/screwdriver
it might not good to allow PUT
, because clients might think they will just change the screwdriver in cart #32658 and not the global screwdiver entity.
Upvotes: 1
Reputation: 2817
If you are talking about same screwdriver then they are same resources. One resource may have several URL's. In that case one of them is chosen to be official URL and is called Canonical URL
. Official screwdriver URL might be /items/screwdriver
where client might get full info about it.
Upvotes: 1