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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Error happened when try to update data

(1) ShareShare
ReportReport
Posted on by

Hello, I try to update data with Odata api, I use patch method send data to following url:

https://api.businesscentral.dynamics.com/v1.0/10333be4-6a7e-41e3-a272-c2a11625f23e/ODataV3/Company('CRONUS%20US')/Sales_Order(S-ORD101003)

the data I send is use json:

{
    "WorkDescription": "testtes:1550480116"
}

But I get error:

{
    "odata.error": {
        "code": "",
        "message": {
            "lang": "en-US",
            "value": "Bad Request - Error in query syntax."
        }
    }
}

May I know how to solve?

*This post is locked for comments

I have the same question (0)
  • I Gusti Made Ari Profile Picture
    3,608 on at

    If using OData , you should specify all the primary key , in this case for sales order should be  :  Sales_Order('Order','S-ORD101003').

    For updating data ,  you need to get the etag first , call the GET command first :

    GET api.businesscentral.dynamics.com/.../Company('CRONUS%20US')/Sales_Order('Order','S-ORD101003')

    the response will return etag information . then you need to add this etag value under request header when update.

    Request Header

    Key : IF-Match

    Value : etag

    (Sample : W/"JzY4O0pBQUFBQUNMQVFBQUFBSjcvMU1BU1FBdEFERUFPUUF0QURBQU13QXRBREFBTUFBd0FEQUFNQUF3QURJQUFBQUFBQT09Njs5OTAzNjgwOyc=")

    PUT  api.businesscentral.dynamics.com/.../Company('CRONUS%20US')/Sales_Order('Order','S-ORD101003')

  • Community Member Profile Picture
    on at

    Hello, I use your way to update, but get error response like follow:

    {
        "error": {
            "code": "RequestDataInvalid",
            "message": {
                "lang": "en-US",
                "value": "Request data is invalid."
            }
        }
    }

  • Community Member Profile Picture
    on at

    Hello, I also try this way, but still not work

    api.businesscentral.dynamics.com/.../Company('Foxit%20Software%20Incorporated')/Sales_Orders(Document_Type='Order',Document_No='SO1900231')

    get response:

    {

       "error": {

           "code": "BadRequest_NotFound",

           "message": "The number of keys specified in the URI does not match number of key properties for the resource 'NAV.Sales_Orders'."

       }

    }

  • I Gusti Made Ari Profile Picture
    3,608 on at

    the key should be correct unless you had published wrong page , which page you are publishing for the web service ?

    is it page 42 ?

  • Community Member Profile Picture
    on at

    Thank you, I finally find out how to update, thank you very much

  • frankiPL Profile Picture
    15 on at

    Hi

    Could you post your solution to this problem?

    I have similar errors and can't make it work.

    Best,

    Marek

  • adityamohite Profile Picture
    79 on at

    Hi Robert,

    Could you post the solution to your problem here? It would be helpful

  • saicharan Profile Picture
    4 on at

    It works for me but is there any possibility that if I want to update more than one sales orders at once like all are of Document Type:: Order but Sales order No is different

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans