As part of our API Testing series, we will see “Sending first GET request in Postman”.
First of all we need some APIs to test. There are many public APIs available which you can use for testing purpose. I will suggest you to register at below site to use free APIs for testing:
I will keep sharing links of public APIs for testing.
Above website provides you APIs for basic operations i.e. CRUD which we have already learnt in previous posts.
To perform a GET request below steps are performed:
- Select the “GET” in http methods drop down.
- Pass the request URI in address bar of Postman.
- Add authorization if applicable.
- Add headers if applicable.
- Click on Send button.
See the image below:
We will pick a GET api from GoRest which list all users:
GET /public-api/users/: list all users.
Above we see ‘GET‘ which says GET HTTP operation can be performed on resource “
/public-api/users/“. To make a proper URI we need to suffix base URL which is “https://gorest.co.in/” with resource name as “https://gorest.co.in/public-api/users/“.
GET request does not required any body i.e. payload i.e Request body. You can notice ‘body’ tab is disabled in postman for GET request in above image.
Since we don’t require any authorisation and headers as of now, so skipping those tabs. Now click on Send button. You will see response body in JSON down. You can see details of all users listed in response body. Details of one user is below:
"name": "Brook Boyle",
"phone": "+1 (284) 666-7715",
"address": "3854 Littel ShoalsSouth Marvin, MN 95343",
Also postman returns you the status code and response time. Response time is the time span in which request was hit to endpoint and return response.
More about API Testing in upcoming posts. Stay tuned.
If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
Author: Amod Mahajan
My name is Amod Mahajan and I am an IT employee with 4+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went throw so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning