Callout Mystery

public class HttpCalloutSample {
public String getCalloutResponseContents(String url) {
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
HttpResponse res = h.send(req);
return res.getBody();
}
}
CALLOUT_REQUEST | System.HttpRequest[Endpoint=  https://xxxx.xxxx.xxxx, Method=GET]CALLOUT_RESPONSE | System.HttpResponse[Status=Method Not Allowed, StatusCode=405]

405 Method Not Allowed
A request method is not supported for the requested resource; for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.

HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
req.setBody();
req.setHeader('Content-Type', 'application/json');
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setBody();

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store