REST vs JSON-RPC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ginty
    Junior Member
    • Jan 2009
    • 2

    #1

    REST vs JSON-RPC

    What is the difference between the two endpoints? Is there doco on when to use each and can both be used from the browser (i.e. is CORS an issue)?
  • e-dard
    Junior Member
    • Aug 2009
    • 2

    #2
    The difference is architectural / design based. Essentially they're both transporting JSON over HTTP.

    A JSON-RPC API typically has one to a few endpoints, where you send methods you want to call on the API (RPC = Remote Procedure Call), while with a RESTful architecture, each resource tends to have its own endpoint.

    Further, with a RESTful architecture typically you will use HTTP verbs appropriately, i.e., idempotent actions (things that don't have side-effects) should be made using GET and PUT, while other actions with side-effects should be made with POST, DELETE etc.


    Personally I found it easier to deal with the JSON-RPC API rather than the RESTful one because in my opinion Betfair didn't do a great job with the design of the RESTful API, and it's a bit counter-intuitive in places.

    Comment

    • AlgoTrader
      Junior Member
      • Mar 2012
      • 243

      #3
      Both are almost identical. The difference is really minor. Personally, I use JSON-RPC because of fewer endpoints. I can easily switch to REST
      Betfair Bots Made Easy

      Comment

      • ginty
        Junior Member
        • Jan 2009
        • 2

        #4
        great, thanks... seems like a maintenance nightmare to have to support two APIs that do the same thing but I guess BF are trying to cater for everyone.

        thanks again

        Comment

        • strictlyunstrict
          Junior Member
          • Sep 2013
          • 4

          #5
          Whilst RESTful endpoints thing is debated more than religion nowadays, I think JSON RPC interface is a little over the top as none of calls are async so I dont really see the benefit (by async mean in terms of picking up results to different messages on different calls). Kind of like their openssl cert things but you still post the username/password, because with just the latter two you can't really do anything on the web interface?

          Comment

          Working...
          X