...

/

Elite Club Search Web Service

Elite Club Search Web Service

Enhance the Elite Club application with a RESTful search endpoint.

Objective

In this chapter, we will expose the REST endpoint for the CRUD and search operation in the Elite Club application.

Elite club APIs

We saw how easy it is to create a Restful web service using Spring Boot. We will be exposing the following methods over HTTP.

URI HTTP Method Description
/club GET Get all clubs
/club/{id} GET Get one club with requsted id
/club/{id} DELETE Delete club with requsted id
/club POST Create new club
/club/{id} PUT Modify club with requested id
/club/serach?searchTerm=? GET Search club with search term

Add a club

We already have business logic to add a club into DB available into our service EliteClubService.java

To expose the RESTendpoint for this operation we need to identify the correct HTTP verb to be used. If we _think of the club _ as a resource, then adding a club is nothing but creating a resource.

The obvious choice is to use HTTP POST. The POST endpoint will look like the following code snippet:

@PostMapping(path = "/club", produces =
...