Possible Duplicate:
Rest URL design - multiple resources in one http call
I have looked for answers on this site and the net, but haven't quite figured out the best way to approach this problem.
As an example, say I have the following REST API
Single resource REST API is straightforward:
/car/{id} --> get car by an id
Multiple resource get for a list of cars:
/cars;ids={id1,id2,id3 etc} --> get list of cars by ids
/cars;list-id={listId};count=5 --> get cars defined by a list id saved in the cloud
/cars;relatives={id};count=5 --> get cars that are related to the car specified by id
A list-id can specify an arbitrary list of elements to return. /cars will just return cars defined in that list.
Note: the matrix params relatives, ids, and list-id cannot all be used in a single GET request. E.g if ids and list-id both appear, then ids will take priority.
Question: Should this be redesigned? And if so, how? Thanks.