Announcements
We are using the Business Central Web services to POST new invoices (such as Sales Invoices, Purchase Invoices, Credits, etc..). When POSTing the data, we use Batch Requests (with the Isolation header) to insert lines and headers at the same time.
Everything worked well until we updated to the latest version of BC. We now receive the following error message when trying to do a batch request with both header and lines in the same request:
{ "error": { "code": "BadRequest", "message": "Invalid Request Body CorrelationId: 6f823976-f6f6-46f9-a6bb-ba06f19bb3c4." } }
After some testing, I found out that, if I only try to add the headers through batch request, it works, but if I try to do the same with the lines, it doesn't work.
Adding lines through normal POST requests (not batch), works.
So it seems like adding lines through batch requests isn't working anymore or isn't working the same as before.
Is anybody else having this issue or knows what it could be related to ?
Thanks, David
Here is an example I tested:
Posting this works:
Thank you for posting back your answer.
After a lot of testing, I found out that the "int and floats" type of fields need to be writing as STRINGS. I don't know why it changed but, it is what it is.
Here is an example of what would have worked:
{
"requests": [
{
"method": "POST",
"id": "r0",
"url": "Company('comp')//PurchaseLinesSynchro",
"headers": {
"Content-Type": "application/json;IEEE754Compatible=true"
},
"body": {
"@odata.etag": "",
"Document_Type": "Invoice",
"Document_No": "24005914",
"Type": "G/L Account",
"No": "53510",
"Location_Code": "",
"Unit_of_Measure": "",
"Quantity": "1.0",
"Direct_Unit_Cost": "371.20",
"Tax_Area_Code": "QC",
"Tax_Group_Code": "TAXABLE",
"Shortcut_Dimension_1_Code": "111"
}
}
]
}
André Arnaud de Cal...
294,157
Super User 2025 Season 1
Martin Dráb
232,930
Most Valuable Professional
nmaenpaa
101,158
Moderator