I have exposed a Rest service method to public
@RestResource(urlMapping='/webhook') global class Services { Private static String ACTION_PARAM = 'action'; Private static String FETCH_UPDATES = 'fetchUpdates'; @HttpPost global static void handleRequest() { RestResponse response = RestContext.response; try{ response.addHeader('Content-Type','application/json'); RestRequest req = RestContext.request; String action = req.params.get(ACTION_PARAM); Object result; if(FETCH_UPDATES.equalsIgnoreCase(action)){ 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
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 :
- Does site guest user is not allowed to make any external service callout?
- My classes are running without with sharing, so they should run in god mode, so why they are not getting result.
- AM I doing something wrong?
Please let me know if anyone need more information to add some more context.
Please help me
