title: Dynamics365 web api update vs upsert
body: <p>I'm quite confused. I understand the actual difference between those two, but I can't see any difference in the actual implementation here.</p>
  
  <p>Here is an excerpt from the docs</p>
  
  <h2><a href="https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/update-delete-entities-using-web-api#basic-update" rel="nofollow noreferrer">Basic update</a></h2>
  
  <blockquote>
    <p>Update operations use the HTTP <code>PATCH</code> verb. Pass a JSON object
    containing the properties you want to update to the URI that
    represents the entity. A response with a status of 204 will be
    returned if the update is successful.</p>
    
    <p>This example updates an existing account record with the accountid
    value of 00000000-0000-0000-0000-000000000001.</p>
  
  <pre><code>PATCH [Organization URI]/api/data/v9.0/accounts(00000000-0000-0000-0000-000000000001) HTTP/1.1  
  Content-Type: application/json  
  OData-MaxVersion: 4.0  
  OData-Version: 4.0  
  
  {  
      "name": "Updated Sample Account ",  
      "creditonhold": true,  
      "address1_latitude": 47.639583,  
      "description": "This is the updated description of the sample account",  
      "revenue": 6000000,  
      "accountcategorycode": 2  
  }
  </code></pre>
  </blockquote>
  
  <h2><a href="https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/update-delete-entities-using-web-api#upsert-an-entity" rel="nofollow noreferrer">Upsert</a></h2>
  
  <blockquote>
    <p>An upsert operation is exactly like an update. It uses a <code>PATCH</code>
    request and uses a URI to reference a specific entity. The difference
    is that if the entity doesn’t exist it will be created. If it already
    exists, it will be updated. Normally when creating a new entity you
    will let the system assign a unique identifier. This is a best
    practice. But if you need to create a record with a specific id value,
    an upsert operation provides a way to do this. This can be valuable in
    situation where you are synchronizing data in different systems.</p>
    
    <p>Sometimes there are situations where you want to perform an upsert,
    but you want to prevent one of the potential default actions: either
    create or update. You can accomplish this through the addition of
    <code>If-Match</code> or <code>If-None-Match</code> headers. For more information, see <a href="https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/perform-conditional-operations-using-web-api#bkmk_limitUpsertOperations" rel="nofollow noreferrer">Limit
    upsert operations</a>.</p>
  </blockquote>
  
  <p>So in reality <code>Basic update</code> as stated above will be an <code>upsert</code> and to achieve a real basic update (update if given account eixists, 404 otherwise) I need to add the <code>If-Match: *</code> header to the <code>PATCH</code> request.</p>
  
  <p>Did I understand that correctly?</p>