You need to sign in to do that
Don't have an account?
Update multiple records using REST AP
Hi Folks,
I have a scenario where I need to update near by 200 records. I tried using the PATCH (PATCH /vXX.X/composite/sobjects) but it gave me error "Cannot specify in an insert call [id]". I was unable to get the resonse when I was passing JSON value.
I also checked with this example : https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_update.htm
Please let me know if someone has faced this issue. Thanks!!
I have a scenario where I need to update near by 200 records. I tried using the PATCH (PATCH /vXX.X/composite/sobjects) but it gave me error "Cannot specify in an insert call [id]". I was unable to get the resonse when I was passing JSON value.
My Code:: Http h1 = new Http(); HttpRequest req1 = new HttpRequest(); req1.setHeader('Authorization','Bearer '+accessToken); req1.setHeader('Content-Type','application/json'); req1.setHeader('accept','application/json'); req1.setMethod('POST'); //req1.setHeader('X-HTTP-Method-Override','PATCH'); string Reqstr = URLXXXXX+'/services/data/v43.0/composite/sobjects'; System.debug('----Reqstr--'+Reqstr); req1.setEndpoint(Reqstr); String JsonTree ='{"allOrNone" : false, "records" : [{ "attributes" : {"type" : "Account"}, "id" : "0012900000Nq1ewAAB", "Phone" :27000}]}';
I also checked with this example : https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_update.htm
Please let me know if someone has faced this issue. Thanks!!
Thanks for helping out!! It didn't worked while setting PATCH method in header.
However, I have figured it out the issue and it worked using patch method in url.
Marking this question as resolved.
All Answers
Thanks for helping out!! It didn't worked while setting PATCH method in header.
However, I have figured it out the issue and it worked using patch method in url.
Marking this question as resolved.