3 ms·
This is really cool, looks like it will make integrating your microcontroller with other systems really easy. But - and I hate to be the REST Nazi - this is RP
by bct 15y ago
This is really cool, looks like it will make integrating your microcontroller with other systems really easy.
But - and I hate to be the REST Nazi - this is RPC, not REST.
"REpresentational State Transfer" is about making things happen by Transferring REpresentations of resources' State.
The GET requests are good, but for setting outputs it should do something like:
PUT http://192.168.1.177/9
with body
HIGH
POST could work too, the important thing is that the resource's state, the resource's address, and the action being performed are all separate.
This RPC system is beautifully simple, it does what it needs to and I can't think of any way that making it RESTful would improve it, but it's not RESTful right now, and calling it that only deepens the confusion about what REST is.
- jasongullickson 15y agoI completely agree. I tried to be clear about this in the readme on the github page. I set out to build it as a "proper" REST interface but ran into some snags with POST on the Arduino side and decided (reluctantly) to implement the output functions as GET requests for the time being. I plan to remedy this as time allows, however I didn't want to put sharing the code at the mercy of my schedule. I have a few more improvements in mind as well and I wanted to gather some feedback to help prioritize future development.
- extension 15y agoWhat you're describing might be called an HTTP API. A REST API would be based on hypertext, standardized media types, and opaque URLs.
- bct 15y agoTrue. Now that you point it out, it is odd that I chose to focus on that one divergence.