function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sreejasreeja 

Rest callouts trialhead challenge logerror

hi i had performed the rest callouts, by authorizing the endpoint url into the remotesite settings and later in the anonymous window i had copied and pasted the code form the trailhead..
 the request was sucessfull, and got the response..
the issue was after the selection of the debuglog checkbox the data is not displayed here;
the code is 
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
request.setMethod('GET');
HttpResponse response = http.send(request);
// If the request is successful, parse the JSON response.
if (response.getStatusCode() == 200) {
    // Deserialize the JSON string into collections of primitive data types.
    Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
    // Cast the values in the 'animals' key as a list
    List<Object> animals = (List<Object>) results.get('animals');
    System.debug('Received the following animals:');
    for (Object animal: animals) {
        System.debug(animal);
    }
}
the screnshots are shown belowgot responseDebug log is Empty
Meghna Vijay 7Meghna Vijay 7
Can you send screenshot of the response using debug log?
sreejasreeja
hi meghna.. here is the screen shot

User-added image
 
Meghna Vijay 7Meghna Vijay 7
Send Screenshot of response.getBody() debug log.
Thanks
sreejasreeja
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
request.setMethod('GET');
HttpResponse response = http.send(request);

system.debug(response.getBody());

hi meghana thanks for your reply, i had make callout like this . and i had got the same empty data in the request
i had tried in the other org, iam getting the response there with the same code, should i have to do any settings in this
 thanks
sree..
Meghna Vijay 7Meghna Vijay 7
Hi,
Did you set the remote site settings with url like:-
https://th-apex-http-callout.herokuapp.com
Thanks
 
sreejasreeja
hi Meghna,

yes i had set the remotesite settings with url ,as i mentioned above, so i am trying to figure out , why it was showing empty , as i had enabled the development mode as well in the advanced user settings ,i had figured out a another problem that 
debuglog is not showing the results for any request.

ex: In anonymous window i had executed this code:

   system.debug('testing');

   system.debug('testing2');
   system.debug('testing3');

 it is getting executing , but in response it was showing the empty, iam thinking to figure out the exact solution ... as i was new to salesforce , other imptant query was, header of this is different as when compared to another org,as  i had shown below
User-added image

the license i had assinged is salesforce license and profile as the systemadministrator, the header of this org is different when compared to other header.

 thanks 
vani

 
Meghna Vijay 7Meghna Vijay 7
You are using professional edition org and if you want REST API to be enabled then you may have to pay extra cash to the salesforce.:P
https://www.google.com/search?q=how+does+professional+edition+in+salesforce+looks+like&rlz=1C1GCEU_enIN829IN829&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiN74aWxKvgAhUWY48KHatQDKgQ_AUIDygC&biw=1280&bih=610#imgrc=RyhObxyUkZ-FTM:
This is how it looks like right.
Thanks
 
sreejasreeja
Hi meghna, im happy to receive a good response form you and support as well, actually iam using the trailhead in the developer edition as a practise....org iam using was a developer edition 

thanks and regards
vani