restful-architecture
How can Socket.io and RESTFul work together?
You’re defining a handler for actions that map to REST over http. POST and GET generally refer to update and query over an entity. There’s absolutely no reason you can’t just define a handler for generic versions of these CRUD operations that can be used in both contexts. The way I generally do this is … Read more
Why PATCH is neither safe nor idempotent?
It’s not safe because in general you can’t safely execute a PATCH request without changing a resource (That’s what it’s for). So why is PATCH not idempotent compared to PUT? It’s because it matters how you apply your changes. If you’d like to change the name property of a resource, you might send something like … Read more
Proper way to consume data from RESTFUL API in django
I like the approach of putting that kind of logic in a separate service layer (services.py); the data you are rendering is quite not a “model” in the Django ORM sense, and it’s more than simple “view” logic. A clean encapsulation ensures you can do things like control the interface to the backing service (i.e., … Read more
How to combine websockets and http to create a REST API that keeps data up to date? [closed]
Idea B is for me the best, because the client specifically subscribes for changes in a resource, and gets the incremental updates from that moment. Do we even need to use REST or is ws enought for all data? Please check: WebSocket/REST: Client connections?
Passing array in GET for a REST call
Collections are a resource so /appointments is fine as the resource. Collections also typically offer filters via the querystring which is essentially what users=id1,id2… is. So, /appointments?users=id1,id2 is fine as a filtered RESTful resource.
When do I use path params vs. query params in a RESTful API?
Best practice for RESTful API design is that path params are used to identify a specific resource or resources, while query parameters are used to sort/filter those resources. Here’s an example. Suppose you are implementing RESTful API endpoints for an entity called Car. You would structure your endpoints like this: GET /cars GET /cars/:id POST … Read more