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 Microsoft Employee

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 Gusti Made Ari Profile Picture
    I Gusti Made Ari 3,594 on at
    RE: How to use web odata api to update sale order line

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

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use web odata api to update sale order line

    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."
        }
    }

  • Suggested answer
    I Gusti Made Ari Profile Picture
    I Gusti Made Ari 3,594 on at
    RE: How to use web odata api to update sale order line

    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"

    }

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans