

How to setup and test Postman API Collection
source link: https://dev.to/daspecialman/how-to-setup-and-test-postman-api-collection-j1k
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Posted on Oct 14
How to setup and test Postman API Collection
If you are a frontend developer, you have likely encountered the need to test your API before integration. For experienced developers, this is not an issue, but for the newbies, it could get confusing.
Whenever we onboard new interns in the dev department of Special Man Global Solution LTD and they are assigned a task, especially a frontend task, the first challenge is how to test the API, and I am always happy to guide them through it.
In this article, I will share a brief on how you can test API endpoints using Postman to help you consume API appropriately.
Accessing the collection
First, you are giving a collection URL for the Postman. When you open it, you will see something like this.
1 and 2. The Request Endpoint and Folder
This section shows the arrangement of the API endpoints. Here they are grouped in folders. Inside the folder, there is the actual endpoint. Showing the endpoint name and the request method.
3. The Environment
This shows any environment setup that contains all variables the Postman collection is set up with.
4. Specification
This allows you to select the preferred pattern or specification you want to view the endpoint request with.
5. Documentation Body
This is the documentation body that describes guides you need to know to be able to consume the request.
6. Run in Postman
This allows you to test the API on the web or your local PC.
7. Request Definition
This shows you the request definition depending on the pattern or specification you selected above.
Testing the endpoint
Click on run in Postman, then Postman for the web.
Select your preferred workspace
Then click on the endpoint you want to test, make sure the method, body and data type are correct, then click on send, you will see the data show.
Request with JWT Authentication
If your endpoint is protected using JWT; you will need to set the auth on Postman else you will be getting unauthorized error.
Login using the login endpoint, copy the JSON Web Token, then click on the collection, under Authorization tab, sent:
Type = Bearer Token
Token = The JWT token you copied.
With this you can access all the endpoints, if you encounter more issues, you inform the backend team to get them fixed.
I hope this article can help you set up and test API endpoints before integration on your frontend project.
The API documentation used here is from The StartUp Intern's Refinery Program
Recommend
-
17
README.md Newman v4 has been released. Check the migration guide...
-
24
www.postman.com Though this is not a very optimum time for making a job switch , Last week I joined Postman a...
-
7
Introduction This article will be sharing the key points about the postman collection and how we can easily convert the swagger JSON document into a postman collection. Before taking a deep dive into this let me give you a brief int...
-
7
Laravel API to Postman This package allows you to automatically generate a Postman collection based on your API routes. It also provides basic configuration and support for bearer auth tokens for routes behind an auth middleware....
-
12
The Tyk API Gateway and Postman Kin Lane March 22, 2022· 4 mins If you Google the...
-
6
Aaron Zhang June 13, 2022 2 minute read ...
-
9
Testing MTN MoMo Collection API in Sandbox using Postman A. Checklist To create...
-
3
Postman Essentials: Exploring the Collection Format
-
12
Build an API with Postman, Node.js, and MySQL
-
13
Asim Munshi July 3, 2023 1 minute read ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK