We know the APIs are the waiters who go into the kitchen and take the food to the table for us. APIs are built with any language. Remember JSON output is not API. It’s just Output. The script that we call to get output is called API.
Now there are 2 very famous API types.
- SOAP ( Simple Object Access Protocol)
- REST ( Representational State Transfer)
We all know about REST APIs which provides data in JSON which we get in to our web system and further we decode that JSON to get our data and display in particular format.
For example https://jsonplaceholder.typicode.com/todos/1 is and API which gives us output in JSON format. So by AJAX we call API and get the result back as JSON and then we decode the JSON and display the data on our webpage.
Now what is the difference between REST & SOAP?
Check this image.
![](https://dilip-parmar.in/wp-content/uploads/2024/04/REST-SOAP.png)
Here postcard is REST API & Envelop is SOAP API.
Certainly a postcard is faster and cheaper to send than an envelope, but it could still be wrapped within something else, even an envelope.
You can just read a postcard too, while an envelope takes a few extra steps, like opening or unwrapping to access what’s inside.
Now to send request for SOAP & output of SOAP is totally different than what we do for REST request and output.
Check this page to see the example of both.
Generally we use REST API for mobile development and in latest web techniques so it’s okay if you don’t know much about SOAP.
Check what we can do with REST.
![](https://dilip-parmar.in/wp-content/uploads/2024/04/REST.jpg)
![](https://dilip-parmar.in/wp-content/uploads/2024/04/HTTP-request-methods-788x1024.gif)
So focus on REST for now, that’s it for now.