I am trying to use the Salesforce sObject Collections REST API resource that was released in Spring '18. Per the Salesforce Documentation, this should be a PATCH request, however when I try to call this resource via curl I receive <h1>Bad Message 400</h1><pre>reason: Bad Request</pre> error. My curl command:

curl "https://org.salesforce.com/services/data/v43.0/composite/sobjects" -X PATCH -H "Content-Type: application/json" -d "{ \"allOrNone\" : true, \"records\" : []}" -H "Authorization: token"

However, when I run this command as a POST, and add in the PATCH method as part of the URL, the command works correctly.

curl "https://org.salesforce.com/services/data/v43.0/composite/sobjects?_HttpMethod=PATCH" -H "Content-Type: application/json" -d "{ \"allOrNone\" : true, \"records\" : []}" -H "Authorization: token"

Any idea why? Am I reading the Salesforce documentation incorrectly?

  • Don't really see a reason of it failing with PATCH. I verified this using POSTMAN and it just worked fine.
    – Jayant Das
    Commented Sep 12, 2018 at 15:48
  • I was able to use PATCH via the Salesforce Workbench REST explorer and it worked fine as well, however when executing from the command line using curl it was throwing this error.
    – Laslos
    Commented Sep 12, 2018 at 16:01
  • I would suspect it to be an issue with curl then? Don't know much about it, so can't really confirm.
    – Jayant Das
    Commented Sep 12, 2018 at 16:02
  • I assume so, however when updating a single object I can use the PATCH method from curl and it works just fine. My code is now working, if nothing else maybe it will help someone who is having similar issues. I suspect it has to do with how the /composite/ resource works.
    – Laslos
    Commented Sep 12, 2018 at 16:06


You must log in to answer this question.

Browse other questions tagged .