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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Batch API Request to Business Central Custom EndPoint

(0) ShareShare
ReportReport
Posted on by 30

Hi,

I have created an API page in Business Central. Single GET/PATCH/PUT requests are working fine. 

But when I send batch patch requests from my C# application I get 404-Not Found http resource api.businesscentral.dynamics.com/v2.0/{myOrgID}/{env}/api/...../contacts('ABC0000')?Company='CRONUS USA, Inc.'

Here is my batch request sample:

--batch_c9e0ac54-6f58-4282-91cb-b116bd7195d5
Content-Type: multipart/mixed;boundary=changeset_f6a5ccb5-9166-4821-9700-0bd9201904f2

--changeset_4e18c9a3-c417-4f39-994c-8a2f5d36276a
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID: 1
PATCH https://api.businesscentral.dynamics.com/........
If-Match: *
Content-Type: application/json;type=entry
{Json Body Here}
--changeset_4e18c9a3-c417-4f39-994c-8a2f5d36276a--

--changeset_c3c6e733-d476-42d0-8fc2-e9a5e41f33b6
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID: 2
PATCH https://api.businesscentral.dynamics.com/........
If-Match: *
Content-Type: application/json;type=entry
{Json Body Here}
--changeset_c3c6e733-d476-42d0-8fc2-e9a5e41f33b6--
.
.
.
.
--changeset_f6a5ccb5-9166-4821-9700-0bd9201904f2--
--batch_c9e0ac54-6f58-4282-91cb-b116bd7195d5--



Error Message:

{
 "responses": [
 {
 "id": "1",
 "atomicityGroup": "5acaa4eb-d2d0-4e66-b456-********",
 "status": 404,
 "headers": {
 "content-type": "application/json; charset=utf-8"
 },
 "body": {
 "Message": "No HTTP resource was found that matches the request URI 'https://api.businesscentral.dynamics.com/v2.0/{orgid}/{env}/api/...../contacts('CT000001')?Company='CRONUS USA, Inc.''."
 }
 }
 ]
}


I have no clue why i'm getting 404 not found error even that URL is working fine for single patch request.
I have the same question (0)
  • Community Member Profile Picture
    on at

    Your url seems strange . the company should be before entity name and if you do batch process, I think you should just use /contacts

  • Suggested answer
    JobLouage Profile Picture
    on at

    Hi,

    Maybe late but in this article you can find a bit easier way to update in batch.

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-connect-apps-tips#batch

    Kind regards,

    Job

  • Community Member Profile Picture
    on at

    Hi Job, I have a similar requirement (creating multiple items in one batch request) and I tried the link you mentioned above. But I cant seem to make this work - I keep getting timeout error. Have you tried this successfully? Can you please share a sample request body to achieve this. I am sharing the request details I am using below -

    request url - api.businesscentral.dynamics.com/.../$batch

    request method - POST

    request body -

    {

       "requests": [

           {

               "method": "POST",

               "url": "items",

               "headers": {

                   "Content-Type": "application/json"

               },

               "body": {

                   "number": "test12",

                   "displayName": "ATHENS test12",

                   "type": "Inventory",

                   "unitPrice": 100.8

               }

           },

           {

               "method": "POST",

               "url": "items",

               "headers": {

                   "Content-Type": "application/json"

               },

               "body": {

                   "number": "test123",

                   "displayName": "ATHENS test123",

                   "type": "Inventory",

                   "unitPrice": 50

               }

           }

       ]

    }

    and I only get server error 500 in response. Can you please guide me here(or anyone else)?

    Edit - An update, if I send one json object in request body then I do get a success after 20 seconds. I am using this as request body - 

    {
        "requests": [
            {
                "method": "POST",
                "url": "companies({{companyId}})/items",
                "headers": {
                    "Content-Type": "application/json"
                },
                "body": {
                    "type": "Inventory",
                    "number": "1040",
                    "unitPrice": 79,
                    "displayName": "testa37",
                    "blocked": false
                }
            }
        ]
    }
    but if I increase even one json object then I get the error 500 again.
  • JobLouage Profile Picture
    on at

    Hi,

    There is actually a nice blog from Arend-Jan Kauffman about this topic.

    I hope you can understand the way BATCH API in BC works based on his blog.

    www.kauffmann.nl/.../

    Regards,

    Job

  • Community Member Profile Picture
    on at

    Thanks Job

    Seems this blog post was made for me. I actually was sending a longer string of ids which was somehow causing the timeouts.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,466 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,829 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,505

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans