Describe the bug
When I make an Odata request with 2 patch commands I receive the following error.
500 Multiple requests within the same change set are not supported by Microsoft Dynamics 365 Business Central OData web services.
Batching serves no purpose if the change set is required to change with each additional command, it will no longer rollback smoothly if the second item fails to patch. This is a serious issue for data consistency purposes.
Batching is specifically mentioned on this page https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/dynamics-rate-limits and that page links directly to the Odata Batch specification.
To Reproduce
Create an API Page, expose as a webservice, create an odata command to update multiple entities through a batch command. Something like the below, typically a library is used to generate odata body.
Execute a post command through batch like this.
http://bc2019w2:7048/BC/ODataV4/$batch
with request payload similar to this.
--c98641e6-4880-402a-a952-016cbf12d653
Content-Type: multipart/mixed;boundary=changeset_a363dc84-8ee5-c2e6-c4b7-c5ffcfac3ee9
--changeset_a363dc84-8ee5-c2e6-c4b7-c5ffcfac3ee9
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 1
PATCH http://bc2019w2:7048/BC/ODataV4/Company('CRONUS%20Canada%2C%20Inc.')/Line(90000) HTTP/1.1
Content-Type: application/json
If-Match: W/"JzQ0O3hPbG93aXdBdGJjSk5lZXFscDdFZ0o0TXI0REo0bWg3dDl1RUxPNTFkOFU9MTswMDsn"
{"@odata.etag":"W/\"JzQ0O3hPbG93aXdBdGJjSk5lZXFscDdFZ0o0TXI0REo0bWg3dDl1RUxPNTFkOFU9MTswMDsn\"","Order":7}
--changeset_a363dc84-8ee5-c2e6-c4b7-c5ffcfac3ee9
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2
PATCH http://bc2019w2:7048/BC/ODataV4/Company('CRONUS%20Canada%2C%20Inc.')/Line(100000) HTTP/1.1
Content-Type: application/json
If-Match: W/"JzQ0OzdRMU9CVHBNRzlTNkFMWjRZMVNIWXJnLzFxZWNEY1h1MFNEUmw2Z2ZWTDA9MTswMDsn"
{"@odata.etag":"W/\"JzQ0OzdRMU9CVHBNRzlTNkFMWjRZMVNIWXJnLzFxZWNEY1h1MFNEUmw2Z2ZWTDA9MTswMDsn\"","Order":8}
--changeset_a363dc84-8ee5-c2e6-c4b7-c5ffcfac3ee9
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 3
--c98641e6-4880-402a-a952-016cbf12d653--
Expected behavior
To execute both patch requests back to back, if one fails, the first one should roll back. If the first one fails the transaction should stop. If they both succeed return with the updated records.
Screenshots
5. Versions:
- Business Central: 15.0.36560.0
Describe the bug
When I make an Odata request with 2 patch commands I receive the following error.
500 Multiple requests within the same change set are not supported by Microsoft Dynamics 365 Business Central OData web services.Batching serves no purpose if the change set is required to change with each additional command, it will no longer rollback smoothly if the second item fails to patch. This is a serious issue for data consistency purposes.
Batching is specifically mentioned on this page https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/dynamics-rate-limits and that page links directly to the Odata Batch specification.
To Reproduce
Create an API Page, expose as a webservice, create an odata command to update multiple entities through a batch command. Something like the below, typically a library is used to generate odata body.
Execute a post command through batch like this.
http://bc2019w2:7048/BC/ODataV4/$batchwith request payload similar to this.
Expected behavior
To execute both patch requests back to back, if one fails, the first one should roll back. If the first one fails the transaction should stop. If they both succeed return with the updated records.
Screenshots
5. Versions: