API 101 with Postman
Tags: postmanstudent, girlscriptsummerofcode, api, postman
Published: 2022-04-30 18:00:27

Hello coders!!!
I had a great learning session this evening hosted by Ali Mustufa (@ialimustufa) on "API 101 using Postman". I Learned about API, Postman, Request-Response pattern, and status codes. Well the part I most enjoyed was the hands-on practice part, where we practiced different methods - Get, Put, Post, and Delete. 
Thanks to #PostmanStudent and #GirlScriptSummerofCode for organizing this workshop.

**My learning experience of Postman API 101 Workshop:**

**API - Application Programming Interface :**
It allows services to communicate with each other. APIs allow developers to access the data from a service like google without any knowledge of the codebase that has been implemented.
Now we can relate it with an example, consider you are the customer who visits his favourite restaurant and request for a bowl of ice-cream for which the waiter acts as a mode of communication between you and the chef. The function of the waiter is to communicate to you whether there is a stock of ice-cream or not, if there is, he will bring it for you. In this example the waiter is analogous to API which takes the user request to the server and brings the result to the users from server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vh6r47tpsyah5mt0di5.png)



**What is Postman?**
Postman is a collaborative API development platform that makes it easier for developer to create, test and monitor APIs with a UI. 
In earlier days, the complex structure of the command line interface, while implementing API requests, made it difficult to read and manage the code. So, to solve this problem, Postman was created which had a minimalistic UI (User Interface) helping developers manage APIs.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezsaovzdpxgxd0bxu82m.png)

Now more than 500,000 organizations and 13 Million developers use postman.


**Hands-On Practice**

Basic Info for request-response codes:

**Different Status code family**
* 200 family : Code is used successfully
* 400 family : There is some problem from the user side.
* 500 family : There is some problem from the server side.

**Follow these steps:-**

**1. Creating fork to your workspace:**
Go to this link and fork this [basics of API workspace link](https://www.postman.com/postman/workspace/postman-student-api-101-workshop/collection/13935790-3246e804-99c9-444e-8248-59da3f9f6122?ctx=documentation)
Link for [Documentation](https://documenter.getpostman.com/view/13935790/TzK2YtWD)

**2. We worked with the Joke API:**
path -> "{base_url}: http://postman-student.herokuapp.com/"
By default, we have 4 jokes with id [0-3]
To get a random joke: {base_url}/joke
To get a specific joke: {base_url}/joke/{id of joke}

3. Different Request methods Implementation:

a. Get Method: To retrieve information

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5y9i32447ggu1y0jp4bz.jpg)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zt6dhcjj8tut7g141a1h.jpg)


b. Post Method: To send information to the server.
Go to the body section then go to raw and select the json format from drop down menu and type this code in the code area.
 `{
        "id": "44",
        "author": "Rishabh Jain",
        "joke": "We start programming with 0",
        "source": "iali.dev"
 }`
From the method select **POST** and then click send.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnwi67y0bwwgbm996n53.jpg)


c. Put Method: To update information on the server.
Go to the body section then go to raw and select the json format from drop down menu and type this code in the code area.
`{
        "id": "44",
        "author": "Rishabh Jain",
        "joke": "Q.Whats the object-oriented way to become rich? 
         Ans.Inheritance",
        "source": "iali.dev"
}`

From the method select **PUT** and then click send.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87ojxt1djg222eiyle2x.jpg)


d. Delete Method: To delete the information from the server.
To delete a joke: {base_url}/joke/{id of joke}

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dtll2kgrwwj733l941xh.jpg)



The session was really helpful and I learned many things about an API, Postman, Request, Response codes, different methods (get, post, put, delete) etc.
The session was perfectly handled by Ali Mustufa. He made sure that we understood every bits and pieces. I thank Girls Script Summer of Code and Postman for organizing this wonderful session.