Apex 调用 apex写的rest
Http h = new Http();
String url = System.URL.getSalesforceBaseURL().toExternalForm()+'/services/apexrest/secureApexRest?id=0030o00002ml4xp';
system.debug('url=>'+url);
// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
// Send the request, and return a response
HttpResponse res = h.send(req);
system.debug(res.getBody());