Friday, March 29, 2024
ExplainerProgrammingTech/Web

Implementing The API | REST | JSON-RPC | XML-RPC | SOAP

In this article we discuss API and Implementing The API with most common standard that we used. I already publish a post about API (Application Programming Interface).


What is API ?

API stands for Application Programming Interface. According to Wikipedia, the definition of API or Application Programming Interface is as follows:

“In computer programming, an Application Programming Interface (API) is a set of subroutine definitions, protocols, and tools for building application software.”

Read this article for more information- What is an API?

You may also like : Difference between Data and Information


Implementing the API

We know that An API defines the messages that are sent from client to server and from server to client. Ultimately, we can send data in whatever format you want, but it is almost always better to use an existing standard because convenient libraries will exist for both client and server to produce and understand the required messages.

Now i am going to explain few most common standards that you should consider:

REST (Representational State Transfer) : 

Access a set of web URLs like http://temp.iotbyhvm.ooo/temp1 or http://temp.iotbyhvm.ooo/temp1/1234 using HTTP methods such as GET and POST, but also PUT and DELETE. The result is often XML or JSON but can often depend on the HTTP content-type negotiation mechanism.

JSON-RPC :

Access a single web URL like http://temp.iotbyhvm.ooo/api , passing a JSON string such as {‘method’ : update, ‘temp’ : [ { ‘ temp-id’ : 1234 } , ‘ description ‘ : ‘ writing API for temp device ‘  ]  , ‘ id ‘ : 12 }. The return value would also be in JSON, like { ‘ result ‘ : ‘OK’ , ‘error’ : null , ‘id’ : 12 }.

XML-RPC :

This standard is just like JSON-RPC but uses XML instead of JSON .

SOAP (Simple Object Access Protocol) :

This standard uses XML for transport like XML-RPC but provides additional layers of functionality, which may be useful for very complicated systems.

So these are few most common standards. You can use any one according to your requirements. I recommend using REST, but you may have reasons to use another common standard. For example, if you are trying to replicate the interface of another XML-RPC service, or you are already familiar with SOAP from other projects, that may all trump the other factors.


Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

Recommended :

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *