Skip to content

Instantly share code, notes, and snippets.

@olopsman
Created October 2, 2019 09:48
Show Gist options
  • Save olopsman/efe027eb5109945fdc6c55eb49715c2a to your computer and use it in GitHub Desktop.
Save olopsman/efe027eb5109945fdc6c55eb49715c2a to your computer and use it in GitHub Desktop.
Apex Sample REST Callout
public class dataTableSampleREST {
@AuraEnabled
public static String getDocumentList() {
String strEndPoint = 'https://www.lopau.com/rest/accounts';
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint(strEndPoint);
Http h = new Http();
system.debug('## => ' + req);
HTTPResponse res = h.send(req);
System.debug('## => ' + res.getBody());
if (res.getStatusCode() == 200) {
system.debug('## res.getBody() =>' + res.getBody());
return res.getBody();
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment