Beginner's Guide to API's ?
Showcase your API expertise by getting certified as a Postman Student Expert
Welcome to my new blog, I hope you are doing great. In this blog, we would be discussing what are API's. In-depth, their types and would be talking about the certifications that you can opt for to stand out and showcase your API skills.
What is an API?
API stands for Application Programming Interfaces . Let's understand it with an example. I am craving sushi, so I visited a resto that is somewhere half a mile from my home. After I visit the resto, the waiter greets me and asks for the order. I ordered Sushi, and now the waiter takes my order to the chef and asks him to prepare the order. Great!
After our order is prepared waiter takes the dish from the chef and serves the customer ( me ). Here, the waiter is acting as a intermediate between the customer (me) and the chef as he is taking the customer's (my) order ( sushi ) to the chef and after the order is prepared by the chef, He brings up to the customer.
The same is the work of an API. It acts as an intermediate between the client and the server. Where in the case of Resto; the client is the customer, the server is the chef and API is the waiter. Whenever our system / client sends any requests to the server it is carried out by the API.
Where are API being used?
Almost everywhere; in fact, you are reading this blog just because of an API. There's an API that retrieves the blogs from the hash node server due to which you can read this blog; It's also responsible for creating, updating, and deleting the blogs.
When you search for any query on Google, API carries a request to the Google server and returns some response. When you signup/log in to a website or an App there's the API that comes into play and helps you connect with the server. Almost whichever App or website you are using, at the backend it's the API that is playing the role ( if the App/website communicates with the server).
Understanding API usage behind Posting picture on Instagram
let's say, I want to post my pic of eating sushi on my instagram account . I would open the Instagram App, launch the camera , click the photo ; for clicking the photo Instagram communicates with the device camera using a hardware API ( hardware API : it is a type of API ). Now , we need to save the pic on the server so that it could be accessed by other users , it does so using an API . After the pic is saved on the server again theres an API that fetches the images from the server to the users device . too much API ...... there's many more....for now, its enough.
What are Requests ?
Requests are the ways how we communicate with our API .
Three important ingredients for making an API request :
Address / URL
Method [ Get, Post ]
Path
When we make a request to our API we specify what we want to get out of this interaction with an HTTP method. We use GET
to fetch data from the server , POST
to send or save data to the server, DELETE
to delete some data from the server ; there are many methods other than these. In addition to a method, an API request requires an endpoint. An endpoint includes a URL with a path.
Status Codes
These are the three digit number ( eg. 404 ) used in HTTP protocol which determines the outcome or the status of the request made by the client to the server . Each status codes have some description about their meaning ex. 404 status code means the file or the resource the client requested for is not available or not found on the server.
Below are some of the status codes with description ; codes starting with :
1 * * : Status codes starting with 1 are known as Provisional / informative codes that are used to provide informational messages to the client . like status code 100 indicates that the server has received the requests and is processing it.
2 * * : Status codes starting with 2 indicate that the requests were successfully processed by the server as intended. like status code 200 means "ok".
3 * * : Status codes starting with 3 is generally used for redirection purposes.
4 * * : Status codes starting with 4 indicate that there was an error in the client's side and the requests could not be fulfilled by the server. like status code 403 means forbidden.
5 * *: Status codes starting with 5 indicate that there was an error in the server's side and the requests could not be fulfilled. like status code 500 means internal server error and status code 503 means service unavailable.
There are many other status codes defined by HTTP to handle all the scenarios that might occur during client-server communication.
Types of API :
Web API's : These API enables applications to communicate with each other over the internet using the HTTP protocol . Web API's are usually based on REST principles [ Representational State Transfer ] and uses the HTTP methods like GET , POST , PULL , DELETE .
SOAP API's [ Simple object Access Protocol ] : These API's are based on XML and simply use SOAP protocol for communications. They often use HTTP protocol but sometimes they might also use SMTP [ simple mail transfer protocol ] .
GraphQl API's: GraphQl is a query language and a runtime for API. It enables and helps the users to have more flexibility and efficient data retrieval. With GraphQL clients can specify the type of data they want reducing the problem of overfetching and underfetching of data.
DataBase API: This API provides a way to interact with the database and enables the user to perform operations like querying, creating, updating and deleting data.
These are just a few types of API's, there are many more which can be defined on the basis of the technology used for development as well as their specific requirements.
Get Certified to stand out and showcase your API skills:
If you are excited about learning about APIs and getting certified. You should check out Postman Student Expert Certification which would help you to master the basics of the API.
That's it for this blog, I hope with the help of this blog, I was able to add some value to your life. Please Like and Share; for any queries, you can leave a comment down and I would be happy to help you out.
Thank you!