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 :
Microsoft Dynamics NAV (Archived)

How to use web odata api to update sale order line

(0) ShareShare
ReportReport
Posted on by

Hello All,

I want to update sale order line on Dynamic 365, I try to use following way:

Send Put request to:

https://api.businesscentral.dynamics.com/v1.0/10333be4-6a7e-41e3-a272-c2a11625f23e/ODataV4/Company('Foxit%20Software%20Incorporated')/Sales_Order_Lines('Order','10000')

I also add IF-Match in header

The data I post is:

{
    "Document_Type": "Order",
    "Document_No": "SO1901101",
    "Type": "Item",
    "No": "REAREAMACOTHMAC",
    "Line_No": 10000,
    "Quantity": 1,
    "Unit_Price": 100,
    "Shipment_Date": "2019-03-12",
    "Shortcut_Dimension_2_Code": "SDKBUFS"
}

But I get follow error:

{
    "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_Order_Lines'."
    }
}

*This post is locked for comments

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

    sales line consist of 3 key : Document type, document no, and line no.

    url should be :

    Sales_Order_Lines('Order','SO1901101','10000')

    and also you can remove the primary key field in request body as not needed

    {

       "Type": "Item",

       "No": "REAREAMACOTHMAC",

       "Quantity": 1,

       "Unit_Price": 100,

       "Shipment_Date": "2019-03-12",

       "Shortcut_Dimension_2_Code": "SDKBUFS"

    }

  • Community Member Profile Picture
    on at

    Hello I try to update as you said, and use put method to send data to

    https://api.businesscentral.dynamics.com/v1.0/10333be4-6a7e-41e3-a272-c2a11625f23e/ODataV4/Company('Foxit%20Software%20Incorporated')/Sales_Order_Lines('Order','SO1901101','10000')

    and my field is:

    {
        "Type": "Item",
        "No": "REAREAMACOTHMAC",
        "Quantity": 1,
        "Unit_Price": 100,
        "Shipment_Date": "2019-03-12",
        "Shortcut_Dimension_2_Code": "SDKBUFS"
    }

    But still get error of

    404 Bad Request - Error in query syntax.

    with response:

    {
        "error": {
            "code": "BadRequest_NotFound",
            "message": "Bad Request - Error in query syntax."
        }
    }

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

    Line No. is integer , so it should be without single quote :

    Sales_Order_Lines('Order','SO1901101',10000)

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 > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans