Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

REST multiple insert

I need to insert few rows into OpportunityLineItem table within single POST request https://*.salesforce.com/services/data/v20.0/sobjects/OpportunityLineItem

Single insert works ok for me: {"OpportunityId":"xxx","Quantity":1,"UnitPrice":100,"PricebookEntryId":"xxx"}

But it fails when I try to POST multiple records {"records" : [{"OpportunityId":"xxx","Quantity":1,"UnitPrice":100,"PricebookEntryId":"xxx"}, {"OpportunityId":"xxx","Quantity":4,"UnitPrice":110,"PricebookEntryId":"xxx"}]}

like image 518
Vadim Avatar asked Oct 12 '22 03:10

Vadim


1 Answers

You can't insert multiple rows in a single call in the rest api, you need to use the bulk api.

like image 84
superfell Avatar answered Oct 14 '22 08:10

superfell