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

Community site session details

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

Cloud REST API sudden problem

(1) ShareShare
ReportReport
Posted on by 13
Hi
 
We have had a system running for a few months with no problems
 
Today I am getting an error when updating a sales header. I have reproduced this in Postman. It still works on a local installation, but not on the cloud installation.
 
Call this endpoint:
 
 
With some data and always get:
 
{
    /error/: {
        /code/: /BadRequest/,
        /message/: /Invalid Request Body  CorrelationId:  42968f61-0607-4262-827d-4a0c75c26542./
    }
}
 
I have tried removing almost all of the body, but I get the same result whatever the body is. I have tried doing a GET and posting the response as a PATCH, just to update the record with the exact same information, making 100% sure all fields are correctly named etc, but it says the same
 
I have had this BadRequest error before and it is usually because you are providing an incorrect variable in the body. So I removed all of them to check which one it is, but it still says BadRequest
 
Same update works on a local installation, with the same REST API installed
 
So, has Microsoft done any kind of update that is breaking this? How do I fix it? Is it possible to see some logging with more details?
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    93,325 Super User 2025 Season 2 on at
    Cloud REST API sudden problem
    Hi, first of all, as far as I know, none of the standard APIs is called SalesHeader. If you need to update the Sales Header, you need to use the following standard APIs, salesOrders,salesQuotes or salesInvoices
    For example,
     
    From the filtering in your Endpoint, you want to update salesQuotes.
    So you need to do the following:
    Get sales quote: https://api.businesscentral.dynamics.com/v2.0/c8558e71-6ad8-4fcd-9f29-3ca165b41bbe/Sandbox223/api/v2.0/companies(554f4f15-9c8e-ee11-be3e-6045bde96b9a)/salesQuotes(976ffabc-90ab-ee11-a56a-6045bd686202)
     
    Update sales quote:
     
    Hope this helps.
    Thanks.
    ZHU
  • Community member Profile Picture
    13 on at
    Cloud REST API sudden problem
    Thanks for the answer
     
    We are using a custom page and therefore the name I use is actually correct and as I said it has worked fine before
     
    Our page takes the type and no as the key. The standard page takes an ID
     
    I just tried to update the sales quote with the standard page and this works as expected. But I have no idea why our custom page stopped working. It keeps saying Invalid body
     
    Posting the exact same body to the standard salesQuotes works as expected
     
    Posting the same body (just removing odata.context, odata.etag and No from the body) also works at creating a new sales quote with our custom page
  • Verified answer
    Community member Profile Picture
    13 on at
    Cloud REST API sudden problem
    It has worked before and suddenly stopped working. It still works on premise

    We have now solved the issue. The problem is that the body contains the @odata.context and @odata.etag tags. They were accepted/ignored before, but are now causing an error. When I remove those tags and put the If-Match header in, it works as expected

    So it seems to be related to an update to Business Central Cloud

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,762

#2
Sumit Singh Profile Picture

Sumit Singh 2,573

#3
YUN ZHU Profile Picture

YUN ZHU 1,930 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans