Developer forum

Forum » Integration » BadRequest_MethodNotAllowed - PATCH' requests for 'salesOrders'

BadRequest_MethodNotAllowed - PATCH' requests for 'salesOrders'

Kim Søjborg Pedersen
Reply

Hello,

I do a salesOrder export til BC, with the BC Default API - EcomOrders. To keep it simple I just have 1 order and 1 orderline in DW and only 2 active table mapping, see screenshot.

The order is created in DC and I can see that the field [OrderIntegrationOrderId] is set in the DW db.

But after this it fails with "message": "'PATCH' requests for 'salesOrders' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services.".

I guess it is the table mapping "EcomOrderLines - salesOrderLines - Item" that is failing

Here is the log 

2025-08-22 09:31:34.8879|DataIntegration|INFORMATION|HttpRestClient: 'https://api.businesscentral.dynamics.com/v2.0/xxxx-x-xxxx-xxxx/Sandbox/api/v2.0/companies(xxxx-xxxx-xxxx-xxxx-xxxxxxx)/salesOrders' invoked with PATCH and '{"currencyCode":"DKK","customerNumber":"12345678","externalDocumentNumber":"ORDER338","sellToAddressLine1":"Erik Eriksen Vej","sellToAddressLine2":"","sellToCity":"Vejle","sellToCountry":"DK","sellToPostCode":"7100","discountAmount":0}'
2025-08-22 09:31:34.9141|DataIntegration|ERROR|Endpoint error: {
  "error": {
    "code": "BadRequest_MethodNotAllowed",
    "message": "'PATCH' requests for 'salesOrders' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services."
  }
} Status: MethodNotAllowed Headers: Transfer-Encoding:chunked,Server:Microsoft-HTTPAPI/2.0,Access-Control-Allow-Headers:Origin, X-Requested-With, Authorization,Access-Control-Allow-Origin:*,Access-Control-Allow-Credentials:true,ms-correlation-x:xxxxxxx.xxx.xxx.xxx,mise-correlation-id:xxxx-x-xxxx-xxxx,Access-Control-Expose-Headers:Date, Content-Length, Server, OData-Version;ms-correlation-x,request-id:96011e3d-138c-4255-890a-3fd4ea70a6d8,X-Content-Type-Options:nosniff,Strict-Transport-Security:max-age=31536000; includeSubDomains,Date:Fri, 22 Aug 2025 07:31:33 GMT,Content-Type:application/json; charset=utf-8
2025-08-22 09:31:34.9153|DataIntegration|ERROR|Error Url: https://api.businesscentral.dynamics.com/v2.0/xxxx-x-xxxx-xxxx/Sandbox/api/v2.0/companies(xxxx-xxxx-xxxx-xxxx-xxxxxxx)/salesOrders. Response Error: {
  "error": {
    "code": "BadRequest_MethodNotAllowed",
    "message": "'PATCH' requests for 'salesOrders' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services."
  }
}. Status response code: MethodNotAllowed
2025-08-22 09:31:34.9240|DataIntegration|INFORMATION|System.InvalidOperationException: {
  "error": {
    "code": "BadRequest_MethodNotAllowed",
    "message": "'PATCH' requests for 'salesOrders' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services."
  }
}
   at Dynamicweb.DataIntegration.Providers.ODataProvider.ODataWriter.Write(Dictionary`2 Row)
   at Dynamicweb.DataIntegration.Providers.ODataProvider.ODataProvider.RunJob(Job job)
2025-08-22 09:31:34.9243|DataIntegration|ERROR|Error: {   "error": {     "code": "BadRequest_MethodNotAllowed",     "message": "'PATCH' requests for 'salesOrders' of EdmType 'Collection' are not allowed within Dynamics 365 Business Central OData web services."   } } Stack:    at Dynamicweb.DataIntegration.Providers.ODataProvider.ODataWriter.Write(Dictionary`2 Row)    at Dynamicweb.DataIntegration.Providers.ODataProvider.ODataProvider.RunJob(Job job)
2025-08-22 09:31:34.9292|DataIntegration|ERROR|Job failed.
2025-08-22 09:31:34.9313|DataIntegration|INFORMATION|Finished job - EcomOrders.
2025-08-22 09:31:34.9317|DataIntegration|ERROR|Batch failed.

 

Screenshot_2025-08-22_100704.png

Replies

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Kim,

When the OData Provider is doing "PATCH" requests it should add a key to the url, so it should look something like this https://api.businesscentral.dynamics.com/v2.0/7dd45d63-24fc-4edd-8ad8-5fd66b6f9733/bc17/api/v2.0/companies(0f8058e0-affd-ea11-bb48-000d3a2fece2)/salesOrders(8e0eacb9-c795-ef11-8a6b-7c1e5204887c)

But looking at it, it seems like a bug, as it detects a PATCH but not adding the GUID to the URL

It fails on sending the Order to BC, the tablemapping only has a conditional of "OrderComplete = true" (if you haven't changed that)

BR

Matthias Sort

 

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Kim,

I can see that I've made a bugfix for this the 7th of July this year, and I can see that it's been merged into the 10.17 branch, so wanted to know what version of Dynamicweb do you use on that solution, as maybe we need to merge it further down to your version?

BR

Matthias Sort

 
Kim Søjborg Pedersen
Reply

Hi Matthias

We are running 10.18.4 at the moment but I'm not sure when you rolled that out til R1, but I have not seen the error there yet, only in the dev inviroment 10.17.0.1

BR
Kim

 
Rasmus Sanggaard Dynamicweb Employee
Rasmus Sanggaard
Reply

Hi,

 

10.18 is already in R1. Seems your 10.17 enviroment is not updated automatically as 10.17.7 is the newest. Please contact our Care department if any problems with that.

 

BR Rasmus Sanggaard

 
Kim Søjborg Pedersen
Reply

Hi,

Yes, now it's 10.18 but when did you roll out 10.18? or is the information on the website somewhere?

 
Rasmus Sanggaard Dynamicweb Employee
Rasmus Sanggaard
Reply

Hi Kim,

 

We have all that information on our DW10 doc site. But here is the direct link for you: https://doc.dynamicweb.dev/documentation/fundamentals/dw10release/releasenotes/changelog.html

 

BR Rasmus Sanggaard

 
Kim Søjborg Pedersen
Reply

Hi,

Not all information, only what and not when it happened.

I thought it should be visible when a version was updated. Both in relation to testing but also so that you can notify the customer to test e.g. features/bugs they have been waiting for.

 

You must be logged in to post in the forum