The POST method is used to create resources. As we are creating a department, we use the HTTP POST method. Again, the URI to create a new department in our example is http://www.packtpub.com/resources/departments. The method type for the request is set by the client.
Assume that the Sales department does not exist in our list, and we want to add it to the list. The Sales data representation looks like the following:
{"departmentName":"Sales","manager":"Tony Greig"}
Now, the sequence diagram of our POST request looks like the following:
The series of steps for the POST request is as follows:
- A Java client makes a request ...