I have a callout that is having an issue with it's POST. I have seen a couple of work arounds for this issue but none of them seem to work with my integration.
req.setMethod('POST');
req.setHeader('X-HTTP-Method-Override','PATCH');
or
adding "?_HttpMethod=PATCH" to the end of the endpoint
I continue to get the error:
{"Message":"The requested resource does not support http method 'POST'."}
Before I move toward Heroku or MuleSoft, is there any other work arounds that I might not have stumbled across yet?
HttpRequest request = new HttpRequest();
//request.setHeader('X-HTTP-Method-Override', 'PATCH');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json');
request.setHeader('AuthToken', authToken);
//request.setEndpoint(UPDATE_LEAD_ENDPOINT + '?_HttpMethod=PATCH');
request.setEndpoint(UPDATE_LEAD_ENDPOINT);
String requestBody = JSON.serialize(updatedLeadData);
request.setBody(requestBody);
Http http = new Http();
HttpResponse response = http.send(request);
String responseBody = response.getBody();
return '';
POST
is only for creating records, you will need to usePATCH
here. I have added references from the docs in my answer.