Different Types of API
GraphQL
SOAP
REST API
gRPC and many more
We have different architectural styles for creating an API.
NOTE:-
In the case of Web Development, there is one type of API that rules them all - It is REST API. REST API is the most popular, most commonly used and most important type of API to know if you are going to work with the web.
REST API
An API that follows a particular set of rules
We use HTTP (Hypertext Transfer Protocol) protocol to interact with the API
HTTP Protocol
GET
POST
PUT
PATCH
DELETE
GET
This is used when we want to get/request resources from the server. Resources can be anything like information, text, data from databases, websites etc.
POST
This is used to send the resources to the server. Resources can be information like name, password that is data of the user by which the user can log in to the website etc.
PUT
It is to do an update method. It is used when we want to replace it with some resource with whatever we are sending over that is updating.
PATCH
It also has something to do with updation. It is used when we want to patch up a resource even though the resources are already updated.
DELETE
It just deletes resources either from the server or from the database. It is a request from a client-side computer to a server-side computer.
Trying out an API using POSTMAN
POSTMAN
Postman helps us to make HTTP requests without having any front end or back end.
What are going to do
We will be making an API request using Postman to get the latitude and longitude of the ISS (International Space Station is a large spacecraft orbiting Earth where astronauts live and work. It is a collaboration of multiple companies and is used for scientific research, and space exploration and also as a testbed for future space missions). And will paste the data that we will be getting into Google Maps and get the location of ISS.
There is an API that gives us real-time ISS location.
https://wheretheiss.at/w/developer
The above picture tells us what the URL we need to access in order to interact with the API and it tells us what kind of response we can expect to get back. It gives a little bit of data on each of the endpoints and depending on what it is you want from the API, we can figure out by looking at the database how we can access it.
I am using the data like latitude and longitude to get the location.
Open the Postman and paste the satellites/[id] example resource URL from the above image.
https://api.wheretheiss.at/v1/satellites/25544
Paste the URL as shown below
Now choose GET request as we want resources and click on send.
As soon as you click on send, you will some data in the body section as shown below
I will be taking latitude and longitude and pasting them into Google Maps to get the location. You can try out other data too.
After pasting both data you will get the current location of ISS as shown below.
Conclusion
In this blog, you get to know about POSTMAN, HTTP protocol, and how to get data using Postman without any front end or back end. By using API and Postman, we can get, send, and update the data.