Last active
September 17, 2018 22:46
-
-
Save gitmatheus/cfa4066d666e6000a40c5b5ff88cc73b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String baseURL = 'https://' + System.URL.getSalesforceBaseUrl().getHost(); | |
string queryStr = 'SELECT+NumLinesCovered,ApexClassOrTriggerId,ApexClassOrTrigger.Name,NumLinesUncovered,Coverage+FROM+ApexCodeCoverageAggregate'; | |
String ENDPOINT = baseURL + '/services/data/v40.0/tooling/'; | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint(ENDPOINT + 'query/?q=' + queryStr); | |
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); | |
req.setHeader('Content-Type', 'application/json'); | |
req.setMethod('GET'); | |
req.setTimeout(80000); | |
Http http = new Http(); | |
HTTPResponse res = http.send(req); | |
System.debug(res.getBody()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment