Exceptional Postman’s API 101 Introduction Experience at Kathmandu University

A collaboration of Postman and Kathmandu University Open Source Community(KUOSC)

Praz Zol Prz Adikary
5 min readSep 27, 2021

‎The day you become old is the day you’re not looking for new experiences anymore. Billie Joe Armstrong

What better than a place where you can test API with industry-level assurance and collaborative experience? Well think no more.

Postman. Living with the motto of easy development and effective collaboration in API development and testing, #Postman has been able to please 98% of fortune 500 companies in the market. What does it take to do so you may ask.

5 Principles of Postman

Principles of Postman

Learnings from the API 101 with Postman event

I am sharing what I’ve learned about APIs from the hands-on demonstration by our very talented instructor and Postman Student Expert Sagar Uprety.

1. What is an API?

Application Programming Interface, API is an interface that allows communication between computers or computer programs. It acts as an abstracting layer that acts as medium to exchange data between computers and third party services.

Example of API

Think API as a charging station on the wall of your home. You can plug chargers for you phones, laptops, desktops and can run different devices as long as they have matching charging heads. Here the switch board acts as an API which hides the technical electrical wiring and user, you can simple get your work done.

If I have to give a technical example, lets take OpenWeatherMap API as an example for weather information. Here’s the situation. You are a website developer and you’ve build an awesome website that lets you to ….. For this you need to show the weather situation of the location. Think, how you gonna do this job. Are you thinking of setting up hundreds of thermometers around hundreds of different location? If so, good luck on that. Here’s how you do that in a more sensible way. You just integrate weather APIs like OpenWeatherMap which displays current time weather information of the location. So you are not doing the job of tracking weather information yourself. You are utilizing the data that is being collected by other third party services.

Requests and Responses

Before going further, I’d like you to be familiar with these 2 key terms in API. As name suggests Requests are the things you ask for. For example, you are in a fancy restaurant and you like to have Bruschetta. You call the waiter and request for your food of choice. The waiter passes this request to the chef and gets back you your dish. One thing to notice in this example, the waiter acts as an API because he is the one communicating between you and the chef. The deliciously made dish is the response.

Technically,
Requests = An API request occurs when a developer adds an endpoint to a URL and makes a call to the server.

endpoint = An API endpoint refers to the touchpoints of interaction between an API and another system. An endpoint provides the location where an API accesses the resources they need.

Response = Responses define the HTTP status code and data returned in a response body and headers. If everything is fine then status code 200 is received and the requested thing is not in the database then error code 404 is received. The requested and received data can be image file, html file, raw, JSON etc.

Different Types of Request in API using Postman

In this section, I’ll be sharing the 4 basic requests you can make with postman.

  1. GET Request
    GET request is used to fetch data from an API. Make a get request using following steps:
    Setup your working environment. Once that is done, create a new request, give it a name. After that paste postman-echo.com/get in the search bar and be sure to select the GET method. Hit send and you’ll receive a JSON response in the box lying on the bottom with status code 200.

2. POST Request
POST is the HTTP method that is designed to send loads of data to a server from a specified resource. Make a POST request using following steps:
Create a new request for POST. Change get to post in postman-echo.com/get i.e. it should be postman-echo.com/post now. Then select POST option in method. Go to raw and then select JSON. Copy the JSON code from the result you received after making the GET request. Paste that in the body. Add your new key-value pair and hit send. You should get the new JSON response with your added data with status code 200.

3.PUT Request
The PUT request method creates a new resource or substitutes a representation of the target resource with the request payload. Make a PUT request using following steps:
Steps are same as in the POST method but few changes are to be made. Be sure to write postman-echo.com/put. Then edit your JSON file and hit send.

4. DELETE Request
The HTTP DELETE request is used to delete an existing data in the data source in the RESTful architecture. Make a DELETE request using following steps:
Make sure you postman-echo.com/delete. Hit send and you’ll receive a JSON response with a message saying the request was handled successfully.

BONUS:

You must be wondering do I have to type the lengthy URL everytime I make a new request? You do not. here’s a quick tip. Just make the root URL a environment variable in postman. First select the URL you want to set as a variable for example in postman-echo.com/put select postman-echo.com and set it as a new variable. Give it a name like BaseUrl or something and now you are good to go.

Final Words

Overall the learning process was fun. The hands-on demonstration was fruitful that has really made an impact to the learners. I’d like to thank Postman and Kathmandu University Open Source Community KUOSC for the event. A special thanks to the man of the hour and the postman student expert Mr. Sagar Uprety for the wonderful session.

--

--