Skip to main content

Notifications

Community site session details

Community site session details

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

Web services | Invoice Lines in batch requests no longer working

(0) ShareShare
ReportReport
Posted on by 25

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"
            }
        }
    ]
}
  • Andy Sather Profile Picture
    on at
    RE: Web services | Invoice Lines in batch requests no longer working

    Thank you for posting back your answer.

  • Verified answer
    David Gaulin Profile Picture
    25 on at
    RE: Web services | Invoice Lines in batch requests no longer working

    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"

               }

           }

       ]

    }

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,157 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,930 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans