title: Can a RESTful POST method be implemented to be idempotent?
body: <p>I am designing a RESTful API that is managing favorites. Each favorite resource can contain details of two items that are considered as part of the favorite. </p>
  
  <pre><code> HTTP POST /favorites
  
   {  "item1" : "ball",
      "item1-ID" : "1",
      "item2" : "bat",
      "item2-ID" : "2"
   }
  </code></pre>
  
  <p>Please excuse the rudimentary JSON payload. The focus is however on the semantics of the POST </p>
  
  <p>The above POST method creates a new favorite resource (that contains a ball (ID 1) and a bat (ID 2))</p>
  
  <p>My question is with regard to the expected behavior when the same POST request is sent twice. The first request will create a favorite (as expected). What should happen when the second request is sent?</p>
  
  <p>1) Signal an error with 409 </p>
  
  <p>2) Signal a success with 201 </p>
  
  <p>1) is not idempotent (as POST is), while 2) makes POST idempotent. </p>
  
  <p>Which is the correct approach?</p>