I have to make an external API Callout(Salesforce to other system) of Type - GET. Also, my request will contain requestBody. So far, it seems like it is assuming it to be a POST Request as soon as I put in the requestBody. As a result, my service returns me the error :

Status Code : 405 {"Message":"The requested resource does not support http method 'POST'."}

However, I cannot get the service converted to a POST. How can I make sure that I am able to send the requestBody for a GET Request in Salesforce?

  • Are you making an apex callout to an external custom implemented web service? Or making a call to a web service implemented in Salesforce using apex? May be provide some code snippet?
    – arut
    Aug 26, 2020 at 7:41
  • I am making a callout to external web service using Apex Aug 26, 2020 at 7:43
  • Ok. Based on your question text, I guess this external web service is a custom implementation that you (or the team you interact with) might have access to. Have you checked if this external system is treating the request as POST (because of the present of request body)? If that's the case then there is nothing that could be done from apex side.
    – arut
    Aug 26, 2020 at 7:48
  • I have checked with POSTMAN, and it is working fine on POSTMAN with Get Request Type, however, I keep receiving the error from apex. Aug 26, 2020 at 8:12
  • 1
    Looks like this is the default behavior of Http & HttpRequest objects and there is no definitive article from SF on how to force the HTTP method. Can you try this request.setHeader('X-HTTP-Method-Override', 'GET') or request.setHeader('Access-Control-Request-Method', 'GET')?
    – arut
    Aug 26, 2020 at 9:38

1 Answer 1


Setting X-HTTP-Method-Override header key should be the fix. Code snippet below:

request.setHeader('X-HTTP-Method-Override', 'GET')

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .