The HTTP POST method posts data to the server. Typically, this method type is used for creating a resource. The @javax.ws.rs.POST annotation designates the method of a resource class to respond to the HTTP POST requests.
The following code snippet shows how you can use the @POST annotation to designate the createDepartment() method to respond to the HTTP POST request. The payload present in the message body will be converted and copied to the department parameter by the framework:
@POST public void createDepartment(Department department) { //Create department entity in data store createDepartmentEntity(department); }