title: When exactly I should use RequestMethod.PUT in spring?
body: <p>While reading difference between <code>PUT</code> and <code>POST</code>, I came across this answer which says:</p>
  <blockquote>
  <p>An HTTP PUT is supposed to accept the body of the request, and then store that at the resource identified by the URI.</p>
  <p>An HTTP POST is more general. It is supposed to initiate an action on the server. That action could be to store the request body at the resource identified by the URI, or it could be a different URI, or it could be a different action.</p>
  </blockquote>
  <p>And now while going through <a href="https://www.journaldev.com/2552/spring-rest-example-tutorial-spring-restful-web-services" rel="nofollow noreferrer">this tutorial</a>, I found this:</p>
  <pre><code>@RequestMapping(value = EmpRestURIConstants.DELETE_EMP, method = RequestMethod.PUT)
  public @ResponseBody Employee deleteEmployee(@PathVariable(&quot;id&quot;) int empId) {
      logger.info(&quot;Start deleteEmployee.&quot;);
      Employee emp = empData.get(empId);
      empData.remove(empId);
      return emp;
  }
  </code></pre>
  <p>I was thinking if I am using <code>PUT</code> I should be using <code>@RequestBody</code>. But this doesnt seem to be the case. And above method seem to use <code>PUT</code> very much like <code>GET</code>, right? Or I am missing anything here?</p>
  <p><strong>Q1.</strong> What are clear purpose of these methods, or at least when certain methods &quot;<strong>cannot</strong>&quot; be used?</p>
  <p><strong>Q2.</strong> Is it like, if I am using <code>GET</code>, then I cannot use <code>@RequestBody</code>, as <code>GET</code> request doesnt contain any and I am left with using only <code>@RequestParam</code> and <code>@PathVariable</code> and <code>PUT</code> and <code>POST</code> can use all. And irrespective of methods all can return <code>@ResponseBody</code>. If all these guessings are correct, is their any official documentation explaining all these restrictions, including for other methods too?</p>