margyle / decaf

Decaf: Does Every Coffee Action, Friend
26 stars 10 forks source link

RPC vs REST #23

Open margyle opened 5 years ago

margyle commented 5 years ago

As introduced by @jjok

Something I have been thinking, which I may open a separate issue about, is that I'm not really sure that brewing coffee very easily fits into the REST model of APIs. REST usually good if you're creating, updating and deleting resources. I think maybe an RPC-style API make work better, where each endpoint is the name of a function that can be called startGrinder(), brewCoffee() etc and the body of the request is the parameters to those functions. I'd be interested in hearing people's opinions. Let me know what you think.

wittekind commented 5 years ago

I think that "brewing coffee" is really the only action that can not be directly modelled in a RESTful style. Most other things are settings and the like and therefore lend themselves to a REST API. One piece of documentation to consult might be the PayPal API standards, as those are a pretty comprehensive real world guide on REST API design. Regarding actions, they include Controller Resources.

margyle commented 5 years ago

Thanks @wittekind, really appreciate your thoughts on this! Lots of good info in this doc, will jump back on this chain after reading it in full.

jjok commented 5 years ago

Yeah, that looks like a really good resource (no pun intended). Luckily I'm off work for a week or so...