So far, we have looked at getting the data. Let's look at some of the data modification operations, such as creating, updating, and deleting (CRUD operations).
Given the popularity of REST for cloud-based API operations, we will do our data manipulation through REST methods.
Let's pick the HSQLDB example with Hazelcast that we worked on previously in this chapter.
The GET
method was a no-brainer, but the choice of the methods for operations such as creating, inserting, and deleting require some deliberation. We will follow the conventions as per industry guidelines:
URL | HTTP operation | Service method | Description |
|
|
| Gets a product given an ID |
|
|
| Inserts the product and returns a new ID |
|
|
| Updates a product for a given ID with the data in the request body |
|
|
| Deletes the product with a provided ID |
Let's look at the implementations in the ProductService
class. We already...