Postman
We have already used Postman in previous chapters for testing our REST APIs. Postman will be helpful when we need to test the application completely. In Postman, we can write test suites to validate our REST API endpoints.
Getting all the users – Postman
First, we shall start with a simple API for getting all the users:
http://localhost:8080/user
The earlier method will get all the users. The Postman screenshot for getting all the users is as follows:
In the preceding screenshot, we can see that we get all the users that we added before. We have used the GET
method to call this API.
Adding a user – Postman
Let's try to use the POST
method in user
to add a new user:
http://localhost:8080/user
Add the user, as shown in the following screenshot:
In the preceding result, we can see the JSON output:
{ "result" : "added" }
Generating a JWT – Postman
Let's try generating the token (JWT) by calling the generate token API in Postman using the following code:
http://localhost:8080/security/generate...