APIs are taking over the world of software development because of the flexibility they provide in building large decoupled systems. When you think about APIs, the first thing that comes to your mind is REST APIs or RESTful APIs. A RESTful API is other name for application program interface (API) that uses HTTP requests to GET, POST, PUT and DELETE data. So REST or Representational State Transfer is a form of protocol which leverages HTTP and is used to design mostly web based products and systems.
But REST APIs is just one of the many types of APIs which exist in the world of software development. There are other protocols to build APIs such as SOAP or RPC.
SOAP is short form for Simple Object Access Protocol. It is basically an XML-based messaging protocol for exchange of information between two systems. SOAP is built upon XML data format. It is quite widely used in Enterprises to build internal applications and it it capable of exchanging complete documents or calling a remote procedure.
A SOAP message is just an XML message with following components :
RPC or Remote Procedure Call is a protocol or a messaging framework that one program can utilise to request a service from a program in another computer on the same network without completely knowing the intricacies of network’s details. This procedure call is also known as a subroutine call or a function call.
Multiple RCPs can be done concurrently because of the lightweight processes or threads that share the same address. An RPC is a synchronous operation requires the requesting program to be suspended until the results of the remote procedure are returned.
RPC is great for the use case in which the flow of control alternates a lot between the caller and the callee. This type of client -server interaction is very well supported by RPC. By design the client and server do not both execute at the same time. The thread or flow of execution keeps on jumping from the callee to the caller in an alternate manner.
More and more products nowdays are exposing their functionalities through APIs only and hence it has become imperative to understand the concept of APIs and various types which of APIs which exist in the market. Although RESTful APIs have the lion’s share of the API market but still it is well worth considering other available protocols.