Yesterday, I attended an awesome session on API development 101 by Postman student community manager Ali Mustufa Shaikh organized by HackOn foundation for the upcoming HackOn2.0 hackathon.
In this article, I am going to share what I had learned in the session.
1.What is API?
API (Application Programming Interface) is an interface that defines interactions between multiple software applications or mixed hardware-software intermediaries.
APIs interact with the server using endpoint where they send and receive the request and update the information making it available to the user.
2.What is Postman and why use it?
Postman is an API(application programming interface) development tool that helps to build, test, and modify APIs. It has the ability to make various types of HTTP requests(GET, POST, PUT, PATCH), saving environments for later use, converting the API to code for various languages(like JavaScript, Python).
Why Postman - It has a wide range of functionality like support for all possible HTTP methods, saving progress, API to code conversion, testing of APIs that can be scheduled and automated.
It helps to see the status codes, time is taken for a response and other performance parameters.
3.Requests
There are many methods that help in making requests but few of them are GET, POST, PUT, DELETE.
Requests can be made using methods, address(URL), path.
Some methods are :
Get: For retrieving information
Post: To send information
Put: To update any information
Delete: To delete information.
Address: This means the address of the website from which data has to be fetched.
Path: It is the destination where the request can get executed.
Let's understand this with example.
https://www.google.com/
is the address of google's homepage.
When you search anything on it, it will take you to results according to the search.
On observing you will find it in URL, it adds /search path to the URL and from there one get their searched results. https://www.google.com/search
.
Along with this request URL also takes the parameter which is mostly key-value pairs. These parameters are of two types:
i) Query Parameter: These are appended to the end of the request URL, Query parameters are appended to the end of the request URL, following '?' and listed in key-value pairs, separated by '&'
ii) Path Parameters: These are part of the request URL, which are accessed using the placeholders preceded by ':'
4.Responses
Methods to Receiving Response of the request :
i) Status Code - They are HTTP codes that tell if the request made is successful or not.
ii) Headers
iii) Accessing Body Data - It contains all the information to which the server responds back to your request.
Different HTTP Status Codes
1xx: Informational – Communicates transfer protocol-level information.
2xx: Success – Indicates that the client’s request was accepted successfully.
3xx: Redirection – Indicates that the client must take some additional action in order to complete their request.
4xx: Client Error – This category of error status codes points the finger at clients.
5xx: Server Error – The server takes responsibility for these error status codes.
Also done the hands-on session on the Postman workspace and got familiar with its interface and how to send requests and receive responses.
Learned about the student programs that Postman offers along with its benefits.
Top comments (1)
Nicely explained 👏 Good job Oshi