|
|
|
|
|
by SilasX
4954 days ago
|
|
That is not a RESTful solution, though: what resource is it acting on? What are the four CRUD operations for it? You have to come up with some added, unnecessary, implementation-exposing abstraction like "CityPair". (In which case "delete" could be ill-defined if, as would be wise, the distance is computed from a lat/long or road table lookup, and so there is no actual database entry that corresponds to the distance between the cities.) That's the problem with REST: it doesn't avoid the complexity of RPC; it just crams it into ever-more-creative resource types. Most API users (sorry, "consumers") would prefer they just be told the format in which to ask for the data, not have to re-discover it through gradually-exposed paths each time. |
|
The distance between the two cities.
> You have to come up with some added, unnecessary, implementation-exposing abstraction like "CityPair".
This is a really weird thing to say. No, you don't. I have no idea why you would think that.
> What are the four CRUD operations for it? [...] In which case "delete" could be ill-defined
Not every method has to be valid for every resource. It's a total non-issue that you can't delete a distance.
(And POST/GET/PUT/DELETE is a very different concept from CRUD.)