Get a Person

What if we need to read a single ‘Person’, or isolate a ‘Person’ entity from a list of entities? Let’s try reading a ‘Person’ entity using its ‘id’ key.

Create a new tab in Postman and specify a target URL of http://127.0.0.1:8080/person/10000001 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 ‘Person’ 10000001 from the database. Click ‘Send’ to issue our read request to the application.

l2-get-person-a

We just read the ‘Person’ entity with ‘id’ key 10000001. While this is not a very human-friendly way to search for a person, it is a simple way to programmatically isolate and reference an entity for reading, updating or deletion. Fortunately there are better ways for a human to search for a Person of interest - as we will see later.

l2-get-person-b