function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
A MeA Me 

Patch callouts from Salesforce not supported.

We need to make calls from Salesforce (using Apex) to an external REST Api and in some calls we need to make a PATCH callout. Why doesn't Salesforce allow making patch callouts?

Its a big issue because its a standard Http method used by many Rest Apis , and Salesforce doesn't support it. I have tried using the workarounds mentioned in one of the ideas https://success.salesforce.com/ideaView?id=0873A000000PST0QAO

Option 1 : adding "?_HttpMethod=PATCH" to the endpoint  , and using method = POST or PUT
Unfortunately this workaround doesnt work if the Rest API one tries to access doesn't allow it, as in my case. Response received is "method not allowed"
Option 2 : Set the method to "POST" and this line is added to code
req.setHeader('X-HTTP-Method-Override','PATCH');
This doesn't work either and the error message is same as the previous one.

This is a deadend. Unless Salesforce enables PATCH callouts or there is a workaround that would work.
Can someone help please?