Salesforce Standard REST API To Insert Leads

We have a use case to build API to accept list of leads in JSON Format to insert leads in Salesforce and have to return the response with inserted records count and error messages if any

For this, I have tried to use the following standard salesforce API.


But as i analysed, this API not doing partial insert in case of any record failure.

Any one suggest me on whether we can use any Standard SF API or we need to have Custom API ?
And is there any way to do partial insertion with Salesforce SF API ?


You will have to build a custom REST apex class for this .Standard API does not allow to do partial transactions .

You can use Database DML and use option boolean AllorNone to keep it false to allow partial transaction and then wrap the response with a wrapper class .

Source : Link , Question Author : Janaki Anandakumar , Answer Author : Mohith Shrivastava

Leave a Comment