COPS(IITBHU) APIS 101 WITH POSTMAN 
Tags: api, postmanstudent, postman, backend
Published: 2021-10-02 13:42:07

API stands for **Application Programming Interface**.
APIs are the little pieces of code that make it possible for digital devices, software applications, and data servers to talk with each other, and they’re the essential backbone of so many services we now rely on.

Any Developer, regardless of the Tech Stack they use, should know at least the basic of this fascinating yet simple technology. 
To ensure this, COPS (IITBHU) organised a hands-on workshop, hosted by Postman Student Expert [Lakshya Singh](https://dev.to/king11)! 

## The Initiation

Lakshya Kicked-Off the Session by introducing himself to the participants and was quick to create a very interactive environment by asking everyone to mention the Engineering Branch they are enrolled in.
![Engineer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n33ig889ta0bnjdq5095.png)


## The Presentation
The Workshop began with a Presentation meant to Familiarise everyone with the basics of APIs and Postman.
#### Agendas of the workshop
* Intro to APIs and Postman
* Requests and Responses
* Trying things out
* Follow-up resources
* Q&A

### APIs
Lakshya gave the non-technical explanation of an API using the example of a Restaurant where the waiter *(API)* takes the Orders of the Customers *(Requests)*, Passes it on to the Chef and then returns with the Dish *(Response)*.

The Technical Definition followed, which in brief was :
> *API is a software intermediary that allows two applications to talk to each other by taking requests and returning responses*

A few more examples were explain what APIs are and what they are used for.

### Postman Introduction
Lakshya started-off this section by drawing a comparison between the Terminal (which uses *Curl*) and Postman for using the API functionalities.
Postman clearly turned out to be the Best choice for API related work since its UI makes it very simple for us to send or receive data and then to process/understand the responses.
![Postman is Best](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dd3s1x9zr4m6snf877iv.jpg)

### Ingredients to make a Request
* **Method** - Type of Request
    
    `GET` `POST` `PUT` `PATCH` `DELETE`
* **Endpoint** - Target URL

    `http://postman-student.herokuapp.com/`
* **Path** - The exact location of the desired API

    `jokes/1/`

*A complete API Request made using Axios:*
```
   axios({
         headers: {
             Authorization: "Token " + " "
         },
         url: http://postman-student.herokuapp.com/ + "jokes/1/",
         method: "GET",
         data: {}
     })
```
### Response
* **Status Code** - Signify the Success of Failure of Requests/Responses

    `200 OK` `201 Created` `404 Not Found`

* **Response Data** - JSON

    ```
    {
      "id": "1",
      "author": "User",
      "joke": "Bugs are features",
      "source": "jokes.dev"
    }
    ```

## The Hand-On Session
This part of the Workshop Lakshya showed us practical use of APIs using Postman to Create request bodies, send Requests, and then to comprehend the Response received.
We were asked to fork this [Basics of API](https://www.postman.com/postman/workspace/postman-student-api-101-workshop/collection/13935790-3246e804-99c9-444e-8248-59da3f9f6122?ctx=documentation), and then we were able to follow along.

Lakshya like a true expert showed us all the Request Methods and resolved the issues and queries of the participants instantly.
There were many funny instances also along the way, one of which is:
> Lakshya was unable to pick an ID for a new `POST` request on the `jokes/` API because the participants has already taken most of the IDs including 11 (his B'Day Date xD), 22, 101.... 
He finally chose the ID 111 suggested by me in the comments!

![Laughing Gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/baly5riozx8inmjmx8ds.gif)
We as the Participants were surely amused ;) ! 

## Conclusion
The workshop was wrapped-up with Lakshya sharing the information about being a Postman Student Expert, about Postman being an Organisation in GSOC and how we can contribute to this Splendid Technology as Developers.

He then shared more Resources related to APIs and Postman and ended the workshop with a Q&A session.
<hr>
*The Workshop was a Great Learning experience for me and I was able to make myself more familiar with APIs and how I can use Postman seamlessly to test the APIs I create.
The Host was extremely Co-operative, Friendly and Knowledgeable which made the session even more Interesting and Interactive.*


**Thank You : ) !**