If you are a web frontend developer or mobile app 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.
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.
This shows any environment setup that contains all variables the Postman collection is set up with.
This allows you to select the preferred pattern or specification you want to view the endpoint request with.
This is the documentation body that describes guides you need to know to be able to consume the request.
This allows you to test the API on the web or your local PC.
This shows you the request definition depending on the pattern or specification you selected above.
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.
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