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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to Create multiple entity record using the Web API?

(0) ShareShare
ReportReport
Posted on by 1,088
Hi, according to MS documentation

Create an entity record using the Web API

the sample for create an account like this 
POST [Organization URI
/api/data/v9.0/accounts HTTP/1.1 Content-Type: application/json; charset=utf-8 OData-MaxVersion: 4.0 OData-Version: 4.0 Accept: application/json

{
    "name": "Sample Account"
}


but i can't send an array like this
[{
    "name": "Sample Account1"
},

{
    "name": "Sample Account2"
},

{
    "name": "Sample Account3"
}...]


How to do that? Thanks.
I have the same question (0)
  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    Hi Pablo,

    We need to use "orgURL/api/data/v9.1/$batch" to insert multiple records in single request.

    Here is an example with Postman:

    4278.PNG

    Body:

    Clofly123 is a unique identifier of the request body, d291f184-3d87-44a2-b12d-6fc13a4d4d9c is a randomly generated GUID.

    You can change them to your own string or guid.

    --batch_Clofly123
    Content-Type: multipart/mixed; boundary=changeset_d291f184-3d87-44a2-b12d-6fc13a4d4d9c
    
    --changeset_d291f184-3d87-44a2-b12d-6fc13a4d4d9c
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    Content-ID: 1
    
    POST https://company.crm5.dynamics.com/api/data/v9.1/accounts HTTP/1.1
    Content-Type: application/json
    
    {
        "name":"aaa"
    }
    
    --changeset_d291f184-3d87-44a2-b12d-6fc13a4d4d9c
    Content-Type: application/http
    Content-Transfer-Encoding: binary
    Content-ID: 2
    
    POST https://company.crm5.dynamics.com/api/data/v9.1/accounts HTTP/1.1
    Content-Type: application/json
    
    {
        "name":"An account"
    }
    
    --changeset_d291f184-3d87-44a2-b12d-6fc13a4d4d9c--
    --batch_Clofly123--

    Headers:

    Content-Transfer-Encoding: binary

    Content-Type: multipart/mixed; boundary=changeset_d291f184-3d87-44a2-b12d-6fc13a4d4d9c

    234.PNG

    Result(success):

    The status code is 200, and it will return batchresponse text in its response message.

    3264.PNG

    Please refer to following links for more details about batch operation:

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/execute-batch-operations-using-web-api

    https://nuxulu.com/2019/10/15/Insert-multiple-records-in-single-request-using-Odata-from-Postman.html

    Regards,

    Clofly

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans