web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Web API Batch POST vs PATCH

(0) ShareShare
ReportReport
Posted on by 5

I am attempting to disassociate a contact reference to a single-valued navigation property by setting the value to null.

This works when I call the web api directly: 

PATCH https://mydynamics.crm.dynamics.com/api/data/v9.2/contacts(00000000-0000-0000-0000-000000000000)
{ "firstname": "John",
"lastname":"Doe",
"lookup1@odata.bind": null,
"lookup2@odata.bind": null,
"lookup3@odata.bind": null
}
//[...other data omitted for brevity...]

So these lookup fields, lookup 1,2, and 3 would be reset to null (The association is removed).

We run a synchronization program that calls these operations in a batch and when this runs -- using the same payload -- the lookup fields fail to reset (although if I modified firstname or lastname - those fields would update). This is a POST batch call containing just the single PATCH operation in this case but it normally contains multiple operations.
All documentation I can find states that PATCH with multiple operation should be a POST call but it didn't reset my lookups. 

If I change the POST batch to a PATCH batch...then it works as expected and all fields are updated correctly including the lookups!

Why the difference between BATCH POST vs PATCH?!

  • Is is a bug in the API?
  • Is it because I only had a single operation in the batch? Would it work for multiple requests? (I didnt try).
  • Does using PATCH instead of POST have any negative affect on either a single operation or multiple operations?  Suppose a DELETE operation was also in the batch for something?
    Microsoft says "Use a POST request to submit a batch operation that contains multiple requests. A batch request can include GET requests and change sets."
  • Why is the documentation lacking on this topic?

Any help is appreciated!

I have the same question (0)
  • Guido Preite Profile Picture
    54,084 Moderator on at
    RE: Web API Batch POST vs PATCH

    If I understood correctly you are sending a batch of these PATCH but the lookups inside these PATCH are not updating to null, correct?

    can you post the whole batch process you are trying to send?

    thanks

  • llewis Profile Picture
    5 on at
    RE: Web API Batch POST vs PATCH

    The test case is a batch with one single patch as above and yes the lookups fail to update to null unless I change the batch from post to patch.

  • Guido Preite Profile Picture
    54,084 Moderator on at
    RE: Web API Batch POST vs PATCH

    ok, can you post this batch call code?

  • CU10100644-0 Profile Picture
    2 on at
    Web API Batch POST vs PATCH
    Did you after all get any further on this topic? I'm facing the same. Setting the POST to PATCH did the trick for me too, and I couldn't yet find any disadvantage. It works for multiple messages within the batch, also the upsert works so it either creates or updates (if you use the PATCH within the single batch messages too).
    Did you experience any drawback by using PATCH instead of POST?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 117

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 117 Super User 2025 Season 2

#3
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 83

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans