Skip to main content

Posts

Showing posts from 2017

REST or JSON RPC

If you don’t want to mess about with XML,   REST   is pretty much the industry standard for creating an API. Initially, we had a REST(ish) API. But after using it internally at HomeRez, we were not very happy with how it works. So we looked around for alternatives. In the end, we decided to go for  JSON-RPC . What are the differences? REST uses  HTTP   or  HTTPS  . JSON-RPC can use any transport protocol, for example TCP  . JSON-RPC has 1 end-point URL for all requests. REST uses different URLs for different resources. In JSON-RPC, any request is sent the same way (e.g. via  HTTP  POST  ) with the method and parameters in it. In REST, you use the HTTP verbs (  GET  ,  POST  ,  PUT  ,  DELETE  ) for different actions. So, what made us switch from REST to JSON-RPC? The main reason is that we  couldn’t find a good way to map all operations in our API to HTTP verbs . We have several operations that are not pure Create, Read, Update or Delete operations. For example, we