3 ms·
A well designed REST interface should allow the requester to specify how much information they want to receive. By default, it's reasonable to assume the reque
by arctangent 15y ago
A well designed REST interface should allow the requester to specify how much information they want to receive.
By default, it's reasonable to assume the requester only wants the barest of information (along with links to related resources) when they access /hero/superman.
But it's perfectly reasonable to provide additional views for common use cases e.g. /hero/superman/powers/detailed or /hero/superman/friends/filter/powers/flight.
- IgorPartola 15y agoUgh. The way you filter a RESTful resource is using the query string. /heroes/superman/powers/detailed is borderline OK: it could conceivably return a 404. However, the filter business is just messy. /heroes/superman/friends?powers=flight is more elegant. See http://stackoverflow.com/questions/4024271/rest-api-best-practices-where-to-put-parameters http://stackoverflow.com/questions/4024271/rest-api-best-pra...
- arctangent 15y agoI think you're probably right about replacing the "filter" part of the URL with a query string instead.