Home Blogs How to test API using Postman?

How to test API using Postman?

by Anup Maurya
7 minutes read
How to test API using Postman?

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

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)

Postman dashboard

Step 3: Create a Workspace

Create a workspace to start your testing.

Create a workspace to start your testing.

Step 4: Create a new HTTP request

After creating a workspace you will the dashboard like this. Click on the new button

Select HTTP request.

after selecting the HTTP request you will see the interface

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.

GitHub Token

This is my new GitHub Token. Copy this Token & save it.

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.

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.

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.

related posts

Leave a Comment

Enable Notifications OK No thanks