After my last article on how to generate a Newman report for postman
I got a request to write about how to install postman and write a test. I also figured a lot of beginners would find this really useful.
A little background info, Postman is one of the most popular platforms used by developers for building and testing APIs, they have an estimated number of 7 million active users and 75,000 public APIs. In this tutorial, I would be explaining how to use postman as an HTTP client to test HTTP requests for different types of responses.
Postman Installation
You need to install postman on your computer.
- Download the postman app by clicking here
- Click on the download option as it depends on your operating system (mac, windows, or Linux)
- Install the downloaded zip file
please note that for mac you need to move the zip file to your applications folder.
Your postman screen should look like this after signing up for a postman account Weldone! you have successfully downloaded postman.
Now let's run a simple GET and POST request on postman
Sample GET request endpoint - gorest.co.in/public/v2/users
- Navigate to your postman and click on create new HTTP GET request
The GET request is used to retrieve data from a database without making changes.
- Add your endpoint URL and API path [gorest.co.in/public/v2/users]
- Click on send to get a response from the endpoint as shown below
The endpoint will return a list of record that has been stored in the database.
Let's run a POST HTTP request endpoint
A POST request is used to create a resource in the database by making API calls Sample endpoint - reqres.in/api/users
- Open a new request tab
- Follow the same instructions as above but this time you need to change your request method (POST).
- Since we are running a POST, we also need to add a request body of the data we want to create in the database.
- Click on send to get a response from the endpoint as shown below.
The endpoint returned a response body that shows a record has been created with an HTTP status code of 201.
Hooray!!! ๐ฅณ you've run your first test.
You can visit this free REST API website to test for more HTTP methods and scenarios on postman.
Don't forget to like and follow my blog if you find this useful and also drop your comments ๐