RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
C++DelphiTech Partner

Quickly Learn To Create And Use JSON-RPC With Modern Delphi MVC Framework

Many situations developers have a debate on REST vs JSON-RPC. Plenty of resources available in Internet to distinguish them. This is one among them and direct how to create and use JSON-RPC with Delphi MVC Framework quickly.

REST: The Word REST is the Abbreviation of the Phase ‘Representational State Transfer’ is the Architectural Design Style and it is not a standard or Protocol. Web services that conform to the REST architectural style, called RESTful Web services, provide interoperability between computer systems on the internet. REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems.

RPC: A remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction.

JSON-RPC : JSON-RPC is a stateless, Light-weight remote procedure call(RPC) protocol.

  • It is transport agnostic, and can be used within the same process, over sockets, over http, or in many various message passing environments.
  • It uses JSON(RFC 4627) as data format.
  • It supports Requests( which are functions) and Notifications( which are procedures)

Request and response:

Notification (no response):

Why JSON-RPC if i have REST?
RPC and REST are only different approaches with pros and cons and both are valuable depending on the context. The context is the key.
There are no universal solutions, you always have to think within a context and must be pragmatic when choosing a solution.

REST Vs JSON-RPC :

REST is Resource oriented while RPC is actions oriented.
REST is strongly tied with the transport protocol while RPC don’t.
REST-based APIs are great for CRUD based operations(Resources and entities). REST is not only CRUD, but things are done through mainly CRUD-based operations.

RPC can works with Sockets, http/https ftp, file system etc. Really it is not tied with any protocol, its just a way to describe an action with its parameters.
RPC-based APIs are great for actions based operations(functions and procedures)

Check this Video which demonstrates JSON-RPC with Delphi MVC Framework.

Check the sample made for JSON-RPC here.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy. Start Free Trial   Free Delphi Community Edition   Free C++Builder Community Edition   Upgrade Today
Sign up for our daily posts newsletter!

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES