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
mkaufmanmkaufman 

How do you use the PATCH method in apex callouts

For various reasons, I'm writing Apex code that calls out to the REST API.  I'm able to authenticate, insert, query, delete, etc with no problem  Updates via the REST API require the PATCH method to be used in the HttpRequest class.  However, it seems that the HttpRequest class does not support the PATCH method.

 

Has anyone else experienced this inconsistency in across the APIs?  Has anyone figured out how to do this or a workaround?

Thanks in advance.

forecast_is_cloudyforecast_is_cloudy

You can just add '?_HttpMethod=PATCH' as a query string parameter to the REST API URI and make a regular POST request. That should do the trick.

mkaufmanmkaufman

Awesome, that worked, thanks.