Skip to main content
Callouts in Apex class XYZ and this method is called from another method with passing one paraeter :

 

========================

 

public void getOneDriveFiles(String accessToken){

 

        Http http = new Http();

 

        HttpRequest request = new HttpRequest();

 

        request.setEndpoint('https://graph.microsoft.com/v1.0/me/drive/root/children');

 

        request.setMethod('GET');

 

        String token = 'Bearer ' + accessToken;

 

        request.setHeader('Authorization', token);

 

        HttpResponse response = http.send(request);

 

        // Parse the JSON response

 

        if (response.getStatusCode() != 200) {

 

          System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());

 

          System.debug('BODY ============================='+response.getBody());

 

        } else {

 

          System.debug(response.getBody());

 

        }

 

    }
9 answers
0/9000