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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Update Sales Order Line using a custom API

(0) ShareShare
ReportReport
Posted on by 27

Hi Experts,

I am facing an issue while update any field of Sales Order Line. Below are the details.

URL: api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrders(SalesOrder ID)?$expand=salesOrderLines

with headers : Content-Type: Application/son, if-match: *

Body :  

{
    "prepayment"40,
    "salesOrderLines": [
        {
            "quantity"25,
            "unitPrice"2000,
        }
    ]
}
Response: 
{
"@odata.etag""W/\"JzIwOzEwMTIxNjUwMjAwMDU2MzY4ODQ2MTswMDsn\"",
            "no""1006",
            "documentType""Order",
            "selltoCustomerNo""C000001",
            "prepayment": 40,
            "salesOrderLines": []
     }
I have the same question (0)
  • Suggested answer
    Gianfranco C. Profile Picture
    374 on at

    hello, the correct call is this:

    Method:  PATCH

    URL: https://api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrders(SalesOrder ID)/salesOrderLines(SalesOrderLineID)

    or

    URL: api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrderLines(SalesOrderLineID)

    Headers:     Content-Type: Application/son, if-match: *

    Body :  

    {    
         "quantity": 25,
         "unitPrice": 2000,
    }

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,
    Gian

  • Suggested answer
    Govinda Kumar Profile Picture
    2,310 Moderator on at

    Hi Khadija,

    this blog post might help you www.kauffmann.nl/.../

    also, check out Microsofts documentation learn.microsoft.com/.../dynamics_salesorderline_update

    Regards

  • Khadija Profile Picture
    27 on at

    hello,

    URL: api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrderLines(SalesOrderLineID)
    this is work for sales line but what i want is to update sales orders and sales line in the some time

    so i try this
    URL: api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrders(SalesOrder ID)/salesOrderLines(SalesOrderLineID)

    but it give me an error

    {
    "error": {
    "code": "BadRequest",
    "message": "Invalid Request Body CorrelationId: 5647f519-9f22-4b87-bb30-2ef526b359ab."
    }
    }

  • Suggested answer
    Gianfranco C. Profile Picture
    374 on at

    I believe that the standard or custom copy of the standard cannot be made.
    You probably need a more structured code to take in all the information from the query url

  • Khadija Profile Picture
    27 on at

    thank you for all your responses.

    what i found with all my search that is impossible to update sales orders and sales line in the some time. so they updated separately with

    URL: api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrderLines(SalesOrderLineID)

    for sales lines

    and

    URL: api.businesscentral.dynamics.com/.../{SandBox Name}/api/v2.0/companies(Company Id)/salesOrders(SalesOrder ID)

    for sales orders

  • Gianfranco C. Profile Picture
    374 on at

    hello, confirming the above.

    happy to have been of help.

    greetings

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,

    Gian

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 595 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 364 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 331 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans