6. Test. Postman and Swagger
Appendix: Postman.
This is free software and, through Postman we can make requests:
- GET, to a route, indicating the parameters in all their possibilities, in the Query of the route, as identifiers in the route.
- POST and PUT, allowing in a very comfortable way to edit the JSON objects in the body (Body) of the request
- DELETE, to carry out deletions.
Let's see how we can work with the queries to our newly created API. The first step to take is to create a workspace or Workspace, where we will add our requests
Then, we could start to create http_request:
we could change the request type in the left selector:
we could set parameters adding ?name=value in the request
And we can set values of variables in the path simply adding to the request (as a text in the path). Remember that this correspond with PathVariable.
If we want to send data, in form of JSON object, as forms do, we must set up inside body as raw data as json in a POST or PUT request:
Finally, here you have a DELETE request:
Apèndix 2: Swagger
In this webpage https://www.baeldung.com/spring-rest-openapi-documentation you can find how to add en emmbedded API test pages to work with the API you are generating easily.