title: URI Convention for Insert and Update - WCF Rest API
body: <p>I have Users collection with User's. User - Id, FName, LName. </p>
  
  <p>For insert, I pass User instance with Id, FName, LName. The service inserts the User if it's not present.</p>
  
  <p>For update, I again pass User instance with all parameters. The service updates FName and LName for the User with the given Id.</p>
  
  <p>I want to have insert and update as 2 separate methods in the service. </p>
  
  <p>I can't have same URI's for both methods. Something like below:</p>
  
  <pre><code>    [WebInvoke(UriTemplate = "Users", Method = "PUT")]
      void  UpdateUser(User instance);
  
      [WebInvoke(UriTemplate = "Users", Method = "PUT")]
      void  AddUser(User instance);
  </code></pre>
  
  <p>Which is the best way to acheive this?</p>
  
  <p>I don't agree with one post saying update URI to have something like :</p>
  
  <pre><code>    [WebInvoke(UriTemplate = "Users/{userId}", Method = "PUT")]
      void  UpdateUser(string userId, User instance);
  </code></pre>
  
  <p>Because, user id is already present in the Userinstance.</p>
  
  <p>Though I agree that PUT method can perform insert and update. For some reason I need to keep them separate.</p>