Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Created August 27, 2018 18:48
Show Gist options
  • Save choudharymanish8585/20d0c407735b1156e5dad62a457dc038 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/20d0c407735b1156e5dad62a457dc038 to your computer and use it in GitHub Desktop.
/**
* Class to demo new Url.getOrgDomainUrl() and UserInfo.getSessionId() methods
*/
public class SameOrgApiDemo{
//This method will make a call to same org
public static void getOrgLimits(){
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(Url.getOrgDomainUrl().toExternalForm()
+ '/services/data/v44.0/limits');
req.setMethod('GET');
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
HttpResponse res = h.send(req);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment