Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Business central api POST bad request

(0) ShareShare
ReportReport
Posted on by 45

Hi

Im creating a rest api for my BC company, and i can retrieve all saleorders (Test company)

But now im following (https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesorder_create) to create a salesorder, but the response is pastedimage1650628338137v1.png

i tried using the company info, and also the basic example.

This is my header settings:

pastedimage1650628421052v2.png

Any suggestions on what im doing wrong?

  • Suggested answer
    Izet Profile Picture
    Izet 45 on at
    RE: Business central api POST bad request

    You are right, it works now without paymentTermsId!

    Thanks! :)

  • Suggested answer
    JAngle Profile Picture
    JAngle 46 on at
    RE: Business central api POST bad request

    if you remove the paymentTermsId do you get the same error? I have virtually the same body working correctly and I know for certain the GUID for the paymentTermsId is present in the company I am POSTing to. I use variables in my example body:

    {
        "number": "1009",
        "customerNumber": "10000",
        "currencyCode": "USD",
        "orderDate": "2021-12-31",
        "paymentTermsId": "{{paymentTermsId}}",
        "salesOrderLines": [
    	{
    		"itemId": "{{itemId}}",
    		"quantity": 1
    	}
        ]
    }

  • Izet Profile Picture
    Izet 45 on at
    RE: Business central api POST bad request

    Also my json data im sending:

    {
      "number": "1009",
      "orderDate": "2015-12-31",
      "customerNumber": "GL00000008",
      "currencyCode": "GBP",
      "paymentTermsId": "3bb5b4b6-ea4c-43ca-ba1c-3b69e29a6668"
    }

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,883 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,569 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans