victorabraham
4/16/2020 - 6:37 AM

Rest Callout to github

//Integration with Github API
public class GithubApi {
    public static String getGithubUserDetails(String githubUserHandle) {
        Http http = new Http();
    
        //Create a HttpRequest instance
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://api.github.com/users/'+githubUserHandle);
        request.setMethod('GET');
    
        // Make the API call and get response
        HttpResponse response = http.send(request);
        String responseString = response.getBody();
        
        //Usually you get response from REST APIs in String format
        //You can process these resonse
        return responseString;
    }
}