Site Guest User not allowed to make callout

I have exposed a Rest service method to public

global class Services {
    Private static String ACTION_PARAM =  'action';
    Private static String FETCH_UPDATES =  'fetchUpdates';

    global static void  handleRequest() {
        RestResponse response = RestContext.response;

            RestRequest req = RestContext.request;
            String action = req.params.get(ACTION_PARAM);
            Object result;
                result = ServicesHandler.fetchUpdates(req.requestBody.toString());
            response.responseBody = Blob.valueOf(String.valueOf(result));
        }catch(Exception ex){
            response.responseBody = Blob.valueOf(ex.getMessage());


Here fetchUpdate method do some callout to an external system Like below request

enter image description here

When I do this request from Postman, it gives expected result but from apex it gives below response

System.HttpResponse[Status=Method Not Allowed, StatusCode=405]

So My questions are :

  1. Does site guest user is not allowed to make any external service callout?
  2. My classes are running without with sharing, so they should run in god mode, so why they are not getting result.
  3. AM I doing something wrong?

Please let me know if anyone need more information to add some more context.

Please help me


“Method Not Allowed” is a specific HTTP error that means you’ve used the wrong method. It has nothing to do with authentication, an invalid endpoint, etc. It simply means you’re trying to do something you haven’t allowed (e.g. you’re trying to perform a GET instead of a POST).

Source : Link , Question Author : ashishcloud , Answer Author : sfdcfox

Leave a Comment