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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Odata - PATCH request to modify already existing Sales Order

(0) ShareShare
ReportReport
Posted on by 51

I am on NAV 2018. Able to create Sales Order through the OData rest services. I need to modify the sales order in order change the "Tax_Area_Code" as the OData POST sales order doesn't work with "Tax_Area_Code". I am having difficulty understanding/using the etag returned by NAV.

Here is the etag returned when I create a sales order:

"@odata.etag": "W/\"JzUyO0pBQUFBQUNMQVFBQUFBSjcvMU1BVHdBdEFESUFNQUEzQURFQU1RQTRBRGNBQUFBQUFBPT05Ozc5NzM1NDIwNDA7Jw==\"",

Here is a reference on how to use the etag value in PATCH request: (https://community.dynamics.com/nav/f/microsoft-dynamics-nav-forum/232296/odata---cannot-update-data-on-page--/674638) last reply.

Key is: If-Match

Value:  W/"'<your etag>'"

in my case: W/"'JzUyO0pBQUFBQUNMQVFBQUFBSjcvMU1BVHdBdEFESUFNQUEzQURFQU1RQTRBRGNBQUFBQUFBPT05Ozc5NzM1NDIwNDA7Jw==\'"

error:

{
"error": {
"code": "BadRequest_MethodNotAllowed",
"message": "'PATCH' requests for 'webService' of EdmType 'Collection' are not allowed within Microsoft Dynamics NAV OData web services."
}
}

What am I doing wrong? Please comment if I am using the etag value properly.

Thanks!

I have the same question (0)
  • Verified answer
    gert@lynge.org Profile Picture
    on at

    I don't think that is the error you get if you use etag in a wrong way, but i think you should fetch an updated etag before modifying the order.

    etag is a sort of version of the record in the NAV/DBC table, and the idea behind it is to prevent someone changing the record while you are changing it. So you read the record and etag, modifies the data and asks NAV/DBC to update the record with your changes if the etag is unchanged. If etag is changed the error is sort of "someone else have changed the record, please do your changes again".

    Anyway - please have a look at the blog post also mentioned in the link you provide (scblog.lynge.org/). Althoug it is in Danish (sorry about that - I'm one of the authors :-) ) It implements this in PowerShell and shows examples on how to insert, modify and delete a customer. So you can see exactly how it is done and test it yourself.

    If you are familiar with powershell you should even be able to implement the change to want using the code - just for testing. And then you can look at requests/headers/body afterwards and implement the same in the language of your choice.

  • Nilesh Gajjar India Profile Picture
    2 on at

    Check this ticket for solution

    I have face the same issue and found solution

    community.dynamics.com/.../patch-requests-for-of-edmtype-collection-are-not-allowed-within-dynamics-365-business-central-odata-web-services

    Enjoy !!!

  • Kishore22 Profile Picture
    51 on at

    this issue has been resolved thanks!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,092

#2
YUN ZHU Profile Picture

YUN ZHU 663 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 515

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans