Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Getting problem in executing batch operation using web API

(0) ShareShare
ReportReport
Posted on by

Hi ,

I am creating a batch request with following header and body ::

Header:: 

POST [Organization URI]/api/data/v9.1/$batch HTTP/1.1

Content-Type: multipart/mixed;boundary=batch_AAA123

Accept: application/json

OData-MaxVersion: 4.0

OData-Version: 4.0

"--batch_AAA123"+"\n"+
"Content-Type: multipart/mixed;boundary=changeset_BBB456"+"\n"+

"--changeset_BBB456"+"\n"+
"Content-Type: application/http"+"\n"+
"Content-Transfer-Encoding:binary"+"\n"+
"Content-ID: 1"+"\n"+

"POST [Organization URI]/api/data/v9.1/tasks HTTP/1.1"+"\n"+
"Content-Type: application/json;type=entry"+"\n"+

"{"
+ "subject"+":"+"Task 1 in batch"+","+
"regardingobjectid_account_task@odata.bind"+":"+
"[Organization URI]/api/data/v9.1/accounts(7df4f60c-d1fe-e811-a96d-000d3af2905b)"+
"}"+"\n"+
"--changeset_BBB456"+"\n"+
"Content-Type: application/http"+"\n"+
"Content-Transfer-Encoding:binary"+"\n"+
"Content-ID: 2"+"\n"+

"POST [Organization URI]/api/data/v9.1/tasks HTTP/1.1"+"\n"+
"Content-Type: application/json;type=entry"+"\n"+

"{"
+ "subject"+":"+
"Task 2 in batch"+","+
"regardingobjectid_account_task@odata.bind"+":"+
"[Organization URI]/api/data/v9.1/accounts(7df4f60c-d1fe-e811-a96d-000d3af2905b)"+
"}"+"\n"+
"--changeset_BBB456--"+"\n"+

"--batch_AAA123"+"\n"+
"Content-Type: application/http"+"\n"+
"Content-Transfer-Encoding:binary"+"\n"+

"GET  [Organization URI]/api/data/v9.1/accounts(7df4f60c-d1fe-e811-a96d-000d3af2905b)/Account_Tasks?$select=subject HTTP/1.1"+"\n"+
"Accept: application/json"+"\n"+

"--batch_AAA123--";

In response, I am getting status code 200 and --batchresponse_f6b059f5-56ae-4be6-8101-55632a9be4cd-- but the new task are not creating in crm.

Please help to find out the solution.

Thanks,

Ankit

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at
    RE: Getting problem in executing batch operation using web API

    Hi partner,

    Please refer to this blog from Dynamics 365 Community.

    You could find samples for "create", "update", "delete" and "retrieve".

    Hope it helps.

    Best Regards

    Leo

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans