In a typical REST request-response model, an API client reads a resource from the server, makes some modifications, and sends the modified resource back to the server to save the changes via the PUT, POST, or PATCH operations as appropriate. While persisting changes, there are chances that the server may modify some of the fields, such as the version field and the modification date. In such cases, it makes sense to return the modified resource representation back to the client in order to keep both the client and the server in sync. The following example returns the modified Department entity back to the caller:
@POST @Path("{id}") public Department editDepartment(@PathParam("id") Short id,
Department entity) { Department modifiedEntity=editDepartmentEntity(entity); return modifiedEntity; }
If you are...