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:
{
"@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"
}
But posting this does not work
{
"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"
}
}
]
}