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 :
Finance | Project Operations, Human Resources, ...
Suggested answer

Issues with Dynamics F&O OData REST API Batch UPDATE/DELETE/INSERT Operations.

(0) ShareShare
ReportReport
Posted on by 10

OData REST API batch UPDATE, DELETE and INSERT requests are accepted by the Dynamics 365 F&O server and the requests return the expected HTTP responses for success, but the changes are not reflected on the server. Performing the same series of operations using the individual requests that were included in the batch request return the identical responses for success and the changes are correctly reflected on the server.

Is this a bug in the Dynamics F&O REST API or do OData REST batch requests require something other than what is specified in the OData 4 specification?

Here is an example POST in PostMan where 2 rows are deleted in a batch operation followed by the success response returned from the server. Even though the response shows the deletes were successful the 2 rows still exist on the server.

POST /data/$batch HTTP/1.1[\r][\n]"
"Accept: multipart/mixed[\r][\n]"
"Content-Type: multipart/mixed;boundary=batch_d1c614d9-86a9-479c-898e-9d17faa39436[\r][\n]"
"OData-MaxVersion: 4.0[\r][\n]"
"OData-Version: 4.0[\r][\n]"
"Prefer: odata.continue-on-error[\r][\n]"
"Content-Length: 862[\r][\n]"
"Host: dci-devdevaos.sandbox.ax.dynamics.com[\r][\n]"
"Connection: Keep-Alive[\r][\n]"
"User-Agent: Apache-HttpClient/4.5.7 (Java/1.8.0_212)[\r][\n]"
"Authorization: Bearer <insert access token here>[\r][\n]"
"[\r][\n]"
"[\r][\n]"
"--batch_d1c614d9-86a9-479c-898e-9d17faa39436[\r][\n]"
"Content-Type: application/http[\r][\n]"
"Content-Transfer-Encoding: binary[\r][\n]"
"Content-ID:b5bbbdcc-1622-4313-bbdb-9577a0e5bcaa[\r][\n]"
"[\r][\n]"
"DELETE /data/RetailDevices('TEST11') HTTP/1.1[\r][\n]"
"Accept: application/json;odata.metadata=full[\r][\n]"
"Content-Type: application/json;odata.metadata=full[\r][\n]"
"OData-MaxVersion: 4.0[\r][\n]"
"OData-Version: 4.0[\r][\n]"
"Content-ID: b5bbbdcc-1622-4313-bbdb-9577a0e5bcaa[\r][\n]"
"[\r][\n]"
"[\r][\n]"
"--batch_d1c614d9-86a9-479c-898e-9d17faa39436[\r][\n]"
"Content-Type: application/http[\r][\n]"
"Content-Transfer-Encoding: binary[\r][\n]"
"Content-ID:6f7f64ff-4880-4dc6-a3d0-207dbfb078d4[\r][\n]"
"[\r][\n]"
"DELETE /data/RetailDevices('TEST12') HTTP/1.1[\r][\n]"
"Accept: application/json;odata.metadata=full[\r][\n]"
"Content-Type: application/json;odata.metadata=full[\r][\n]"
"OData-MaxVersion: 4.0[\r][\n]"
"OData-Version: 4.0[\r][\n]"
"Content-ID: 6f7f64ff-4880-4dc6-a3d0-207dbfb078d4[\r][\n]"
"[\r][\n]"
"[\r][\n]"
"--[\r][\n]"

"HTTP/1.1 200 OK[\r][\n]"
"Content-Type: multipart/mixed; boundary=batchresponse_9f4bd7b4-d9cd-4cee-b314-43ca4ead8881[\r][\n]"
"Server: Microsoft-IIS/10.0[\r][\n]"
"Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]"
"OData-Version: 4.0[\r][\n]"
"ms-dyn-fqhn: [\r][\n]"
"ms-dyn-namespace: AxProdDevTest[\r][\n]"
"ms-dyn-tenant: lcs-10e54ad3-4872-49ea-afa9-965b4a218736[\r][\n]"
"ms-dyn-role: [\r][\n]"
"ms-dyn-aid: a1d83f78-5768-0002-e2b6-dba16857d601[\r][\n]"
"X-Content-Type-Options: nosniff[\r][\n]"
"X-Frame-Options: SAMEORIGIN[\r][\n]"
"p3p: CP="No P3P policy defined. Read the Microsoft privacy statement at "">go.microsoft.com/.../
"Strict-Transport-Security: max-age=31536000; includeSubDomains[\r][\n]"
"Date: Tue, 14 Jul 2020 17:33:50 GMT[\r][\n]"
"Content-Length: 360[\r][\n]"
"[\r][\n]"
"--batchresponse_9f4bd7b4-d9cd-4cee-b314-43ca4ead8881[\r][\n]"
"Content-Type: application/http[\r][\n]"
"Content-Transfer-Encoding: binary[\r][\n]"
"[\r][\n]"
"HTTP/1.1 204 No Content[\r][\n]"
"[\r][\n]"
"[\r][\n]"
"--batchresponse_9f4bd7b4-d9cd-4cee-b314-43ca4ead8881[\r][\n]"
"Content-Type: application/http[\r][\n]"
"Content-Transfer-Encoding: binary[\r][\n]"
"[\r][\n]"
"HTTP/1.1 204 No Content[\r][\n]"
"[\r][\n]"
"[\r][\n]"
"--[\r][\n]

I have the same question (0)
  • J Tang Profile Picture
    5 on at
    RE: Issues with Dynamics F&O OData REST API Batch UPDATE/DELETE/INSERT Operations.

    Getting the issue in this post. Currently on a devbox, I've tried adding the cross-company parameter but still the batch operations aren't executing. Each response is just

    --batchresponse_d57977d2-0aa4-447f-a39d-63c3c4a86b6d

    Content-Type: application/http

    Content-Transfer-Encoding: binary

    HTTP/1.1 204 No Content

    Anyone know what the issue is?

  • Sergei Minozhenko Profile Picture
    23,093 on at
    RE: Issues with Dynamics F&O OData REST API Batch UPDATE/DELETE/INSERT Operations.

    Hi John,

    What kind of environment are you using (PROD, sandbox (self-service?), devbox? Also, what PU version? I quickly tried it in my environment and batch deletion works (at least in devbox).

    The only difference (at least quickly found) that in my request that cross-company parameter is used

    POST {host}/data/$batch?cross-company=true HTTP/1.1

    DELETE {host}/data/RetailDevices('test1')?cross-company=true HTTP/1.1

  • Bharath Govinda Profile Picture
    on at
    RE: Issues with Dynamics F&O OData REST API Batch UPDATE/DELETE/INSERT Operations.

    @john Could you please create a support ticket to Microsoft referring to this thread. We need details to check the issue further.

    Thanks 

    Bharath 

  • John Hensley Profile Picture
    10 on at
    RE: Issues with Dynamics F&O OData REST API Batch UPDATE/DELETE/INSERT Operations.

    Thanks for the suggestion. I'm still seeing the same behavior following the batch instructions where performing a batch delete using the REST API returns  HTTP 204 No Content success status response code for each row specified but the rows are not being deleted from the server. This is the output from the PostMan console showing the batch request being sent to the Dynamics F&O server and the server returning a 204 success response for each of the batch delete entries but the rows are not being deleted on the server. Performing delete requests individually not using batch returns the same 204 success response and does actually delete the rows on the server.

    POST dci-devdevaos.sandbox.ax.dynamics.com/.../$batch
    200
    80 ms
    Network
    Request Headers
    Content-Type: multipart/mixed; boundary=changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4
    Authorization: {{access_token}}
    User-Agent: PostmanRuntime/7.26.2
    Accept: */*
    Cache-Control: no-cache
    Postman-Token: 1a026948-c40c-4c08-8e72-068179ae8d47
    Host: dci-devdevaos.sandbox.ax.dynamics.com
    Accept-Encoding: gzip, deflate, br
    Connection: keep-alive
    Content-Length: 4225
    Request Body
    --batch_7bf57939-a923-4e49-92d3-20fb4f2c8435
    Content-Type: multipart/mixed; boundary=changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4

    --changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    Content-ID: 1

    DELETE /data/RetailDevices('TEST11') HTTP/1.1
    OData-Version: 4.0
    OData-MaxVersion: 4.0
    Content-Type: application/json;odata.metadata=minimal
    Accept: application/json;odata.metadata=minimal
    Accept-Charset: UTF-8
    User-Agent: Microsoft.OData.Client/7.5.4
    Authorization: {{access_token}}

    --changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    Content-ID: 2

    DELETE /data/RetailDevices('TEST14') HTTP/1.1
    OData-Version: 4.0
    OData-MaxVersion: 4.0
    Content-Type: application/json;odata.metadata=minimal
    Accept: application/json;odata.metadata=minimal
    Accept-Charset: UTF-8
    User-Agent: Microsoft.OData.Client/7.5.4
    Authorization: {{access_token}}

    --changeset_8a6f6ebe-e9c9-44a2-b980-c33a69370eb4--
    --batch_7bf57939-a923-4e49-92d3-20fb4f2c8435--↵↵

    Response Headers
    Content-Type: multipart/mixed; boundary=batchresponse_10476b89-82aa-4148-bc2e-783e5b1062ec
    Server: Microsoft-IIS/10.0
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    Strict-Transport-Security: max-age=31536000; includeSubDomains
    OData-Version: 4.0
    ms-dyn-fqhn:
    ms-dyn-namespace: AxProdDevTest
    ms-dyn-tenant: lcs-10e54ad3-4872-49ea-afa9-965b4a218736
    ms-dyn-role:
    ms-dyn-aid: 6c36e85f-6264-0001-83a1-386c6462d601
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    p3p: CP="No P3P policy defined. Read the Microsoft privacy statement at ">go.microsoft.com/.../
    Date: Wed, 29 Jul 2020 19:58:27 GMT
    Content-Length: 360

    Response Body
    --batchresponse_10476b89-82aa-4148-bc2e-783e5b1062ec
    Content-Type: application/http
    Content-Transfer-Encoding: binary

    HTTP/1.1 204 No Content


    --batchresponse_10476b89-82aa-4148-bc2e-783e5b1062ec
    Content-Type: application/http
    Content-Transfer-Encoding: binary

    HTTP/1.1 204 No Content


    --batchresponse_10476b89-82aa-4148-bc2e-783e5b1062ec--

  • Suggested answer
    Sukrut Parab Profile Picture
    71,699 Moderator on at
    RE: Issues with Dynamics F&O OData REST API Batch UPDATE/DELETE/INSERT Operations.

    Hi John ,

    Take a look at  my blog post and see if it helps

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 789 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 607 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 497 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans