3 ms·
How do you guys deal with "actions" in your API's that are not CRUD? Something like reserving an airline seat where you just want to pass in an id of a seat and
by ripberge 13y ago
How do you guys deal with "actions" in your API's that are not CRUD? Something like reserving an airline seat where you just want to pass in an id of a seat and a user id. I guess that's what PATCH would be for? I was unaware of this verb until today.
What I'm struggling with is that REST does not seem to fit with how we use the web today. These HTTP verbs were designed for a document centric era of the web, not for the complex processes we're modeling today. I'm not really seeing REST being easier to design or consume than RPC style web api's--isn't that the whole point?
I mean if you were designing an API to be consumed internally in Ruby/JAVA/C# etc, would you design it like REST? I wouldn't. Why have we all become convinced we need to do this for a web api?
- hayksaakian 13y agoPOST to /reservations
- ripberge 13y agoSo I'd have to POST an object that represents a process? It seems like you end up cluttering your code with objects to represent every process? Which in OO programming would just be a method call...
- phamilton 13y agoThe point is to avoid implicit state. By treating the change in state as a first class citizen you can be explicit about the change. In my experience, managing state is very difficult in large applications. Most of the bugs I've dealt with have been the result of our design not being explicit enough.
- deleted 13y ago[deleted]