Get Some Persons

So far we have created a few ‘Person’ entities. We have observed that upon successful creation of an entity, a JSON representation of that entity is passed back to us via the response-writer. Let’s now look at how we can get a list of all of our ‘Person’ entities.

Create a new tab in Postman and specify a target URL of http://127.0.0.1:8080/persons making sure to select the http GET method. Next, add the following key-value pair to the http header:

  • Authorization : Bearer *paste-your-JWT-here*

When you have finished, the test session should look as follows and it is time to read some ‘Person’ entities from the database. Click ‘Send’ to issue the read request to the application.

persons-a

We just read the complete list of ‘Person’ entities. Adding an ‘s’ to the entity name and issuing the request with a GET http verb tells a jiffy application to read all of the ‘Person’ entities. In some cases (like this one), the pluralization of the entity name via the addition of an ‘s’ looks odd, but it makes it quite easy to consume the services. Notice that the ‘href’ field of each ‘Person’ entity provides a direct link to the entity that it is a part of.

person-b