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...
Suggested Answer

Cannot create Sale Order through API

(0) ShareShare
ReportReport
Posted on by 5

I've got this error while trying to create sale order through API.

Every thing is set up following the guide line, but still got error. Already try different content-type (application/json;odata.metadata=minimal;EEE754Compatible=true)  but also not work.

{
    "error": {
        "code": "BadRequest",
        "message": "Invalid Request Body  CorrelationId:  9b68df58-b11a-4485-8069-84f8e2b06384."
    }
}
My request body:
{
    "customerNumber": "1728",
    "orderDate": "2023-05-30",
    "postingDate": "2023-05-30",
    "billToCustomerNumber": "1728",
    "sellToAddressLine1": "BLK 704 ANG MO KIO AVENUE 8",
    "sellToAddressLine2": "#01-2559",
    "sellToCity": "",
    "sellToState": "",
    "sellToCountry": "",
    "sellToPostCode": "560704",
    "shipToAddressLine1": "BLK 704 ANG MO KIO AVENUE 8",
    "shipToAddressLine2": "#01-2559",
    "shipToCity": "",
    "shipToState": "",
    "shipToCountry": "",
    "shipToPostCode": "560704"
}


pastedimage1683934546029v2.png
I have the same question (0)
  • Suggested answer
    Gianfranco C. Profile Picture
    370 on at

    hello, try using the API instead of the Odata call.
    Set your url like this:

    pastedimage1683964187610v1.png

    in the company you must use the company id and not its name

    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
    Ramiz Profile Picture
    597 on at

    Hi Nam Ta 

    This is very common error when you are passing a value in JSON that doesn't exit on the API Pages or the name that you have put in JSON is wrong.

    Please check all of the fields are available in the sales order API page and with same name. customerNumber, OrderDate etc.

    You can also test it by passing only the customerNumber and see if it is inserting the record or not. If it gets inserted then your JSON has some field thats not available on the API page.

    {
        "customerNumber": "1728",
        "orderDate": "2023-05-30",
        "postingDate": "2023-05-30",
        "billToCustomerNumber": "1728",
        "sellToAddressLine1": "BLK 704 ANG MO KIO AVENUE 8",
        "sellToAddressLine2": "#01-2559",
        "sellToCity": "",
        "sellToState": "",
        "sellToCountry": "",
        "sellToPostCode": "560704",
        "shipToAddressLine1": "BLK 704 ANG MO KIO AVENUE 8",
        "shipToAddressLine2": "#01-2559",
        "shipToCity": "",
        "shipToState": "",
        "shipToCountry": "",
        "shipToPostCode": "560704"
    }

  • Nam Ta Profile Picture
    5 on at

    Hi Ramiz , I tried to send only customer number but  the error is consistent. Do you have any suggestion where can I find information about proper names or  fields inthe API page?

  • Nam Ta Profile Picture
    5 on at

    Hi @Gian,

    As API is automatically generated by web service in Business central, I don't see it should be the cause here. Anw, I tried to use company id it's still got same error

  • Suggested answer
    Ramiz Profile Picture
    597 on at

    Hi Nam Ta 

    Please have a look at here. You can see the API pages.

    Also please check the API URL as well.

    learn.microsoft.com/.../dynamics_salesorder_create

  • Suggested answer
    Saurav.Dhyani Profile Picture
    14,380 Super User 2025 Season 2 on at

    Hope this helps 

    [View:https://youtu.be/TSQiE42tDwU:320:240]

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,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans