Featured post
Is a RESTful url valid without ids between objects? -
i have 2 restful api design questions. let's have fruitstand web app. want return information fruits carry , counts fruits, , with:
http://myfruitstand.com/fruits
question 1: if have 10 oranges, i'm thinking can information particular orange with:
http://myfruitstand.com/fruits/oranges/3
but above url restful--don't need id between 'fruits' , 'oranges' conform rest standards? or url 'fruits' being followed subclass 'oranges' okay?
question 2: similarly, if want have discussion forum oranges (not particular orange), can put here:
http://myfruitstand.com/fruits/oranges/comments
again, above url restful since there's no id between 'oranges' , 'comments' (an id here, of course, imply discussion particular orange , don't want that)? here, there's no subclass rational of 'oranges' being followed 'comments.'
thanks in advance, chuck
it more restful construct resource-collection/id pairs, e.g. /fruits/:id1/items/:id2, id1 = orange, id2 = 3
/fruits/orange/items/3
then answer second question correct if lose 's' on oranges, treating orange instance of resource , not resource collection.
/fruits/orange/comments
e.g. slide 48 of http://www.slideshare.net/wombert/phpnw10-designing-http-services-and-restful-interfaces
- Get link
- X
- Other Apps
Comments
Post a Comment