+ Start a Discussion
D VelD Vel 

Test Rest API from Salesforce using Named Credentials

I am trying to test the API Callouts from Salesforce using the Named Credentials. I have setup the Named Credentials and OAuth Providers and was able to quickly test the Authentication within Named Credentials
User-added image
I am trying to write the Apex Class to see if I can retrieve records from the Rest API I am not how to test Executing this Anonymously without calling from a button/VF Page
public with sharing class RetrieveD365Data {
    public RetrieveD365Data() {
              Http http = new Http();
              HttpRequest req = new HttpRequest();
              HttpResponse res = http.send(req);
              System.debug('Response Body===========' + res.getBody());
Please help me with this as I am new to Salesforce