Table of Contents
In this article you will learn how can you test your first API using Postman.
Postman is an API platform that developers use to test, and build APIs. Today, we use APIs for many reasons such as data showing to users etc. But some of us don’t know how to use to test APIs before implementing to code.
So, don’t worry in this article we will see how can we easily test an API. Before going to the main topic a little bit of Postman.
What is Postman?
Postman is a powerful tool for testing, documenting, and debugging APIs. It provides an easy-to-use interface for sending HTTP requests to API endpoints and viewing the responses.
How to test your first API?
Let’s begin with it. We will use GitHub rest API to test your first API. To know about GItHub Rest API check the documentation
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image.png)
Step 1: Install Postman/ use the website
To use Postman you can download it to your local system or also you can use the website.
Step 2: Create an account
Create an account to start your work. After creating your account you will see the dashboard & click on the workspace(left-hand side option)
![How to test API using Postman? Postman dashboard](https://impactmillions.org/wp-content/uploads/2024/06/image-2.jpeg)
Step 3: Create a Workspace
Create a workspace to start your testing.
![How to test API using Postman? Create a workspace to start your testing.](https://impactmillions.org/wp-content/uploads/2024/06/image-1.jpeg)
Step 4: Create a new HTTP request
After creating a workspace you will the dashboard like this. Click on the new
button
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image-8-scaled.jpeg)
Select HTTP request.
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image-5-scaled.jpeg)
after selecting the HTTP request you will see the interface
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image-3.jpeg)
Now we need to test GItHub API. In case we will GitHub API & GitHub token.
GItHub API: https://api.github.com/repos/anup-maurya/Hacktober_Birthday/contributors to check my project’s contributors.
And create a GitHub token from GitHub settings > Developer settings > personal access token > token(classic) & create one.
![How to test API using Postman? GitHub Token](https://impactmillions.org/wp-content/uploads/2024/06/image-6.jpeg)
This is my new GitHub Token. Copy this Token & save it.
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image-7.jpeg)
Now go to your Postman dashboard & visit the workspace that you’ve created.
Paste the GitHub API to the GET field & click on the send button. You can see the JSON format.
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image-4.jpeg)
But it’s ok to test for development, for production, we have to use a token to get more requests. GitHub rest API has a rate limit without auth. Using auth you will get more requests. If you want to read you can the official docs.
but how to add auth token? simple select the Authorization tab then select Bearer Token from the dropdown & paste the copied auth token there. Click on the send button. You will see the same JSON values.
![How to test API using Postman?](https://impactmillions.org/wp-content/uploads/2024/06/image.jpeg)
Kudos 🎉 you have completed your first API test using Postman.
Conclusion
In this article, we saw how we can easily test our first API. We also learned how to create and add a GitHub auth Token into it, and how to use the GitHub API. With these skills, we can test any APIs that provide reliable services to our users. By following best practices and incorporating authentication into our APIs, we can ensure the integrity and confidentiality of sensitive information.