Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Web API POST, create two records at once?

Posted on by 5

Hello,

I am testing Dynamics 365 CRM web API calls with Postman.

Using this URI: https://<mysite>.crm.dynamics.com/api/data/v8.2/contacts

If I POST this JSON code:

{
"firstname": "Joe",
"lastname": "Doakes"
}

The new contact record is created perfectly.

But if I try to POST an array of two records:

[
{
"firstname": "Joe",
"lastname": "Doakes"
},
{
"firstname": "John",
"lastname": "Doakes"
}
]

I get this error: "An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected."

Is it not possible to post more that one record at a time?  Or is my syntax faulty?

Thanks for any help on this.

Bryan Hunt

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Web API POST, create two records at once?

    Hi Bryan,

    I am trying to create contact in MS CRM using postman . i have done the same thing but getting 401 unauthorised error. i am using basic authentication. Can you help me here.

    Rinkesh Rathor  

  • ccnwo Profile Picture
    ccnwo 5 on at
    RE: Web API POST, create two records at once?

    Thanks Ben.  I had seen that article, but wasn't sure if it was strictly for transactional integrity, or if it pertained to any form of batched inserts/updates.

    Now that I know that it is the only supported method for multi-record updates, I will incorporate it into my code.

    Bryan Hunt

  • Verified answer
    Ben John Profile Picture
    Ben John 559 on at
    RE: Web API POST, create two records at once?

    Hi Bryan,

    you need to use a batch request to create multiple records of the same type in same operation.
    MSDN: Execute batch operations using the Web API

    Regards,
    Ben

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans