You need to sign in to do that
Don't have an account?

HTTPResponse is returning no values
Hi,
I am trying to use ToolingAPI to fetch Pagelayout informations. As I am using lightning, so I have created
1.connected app:

2.Auth Provider:
3.Named Credential:
Please find below the the code snippet:

Am I doing anything wrong? Please help.
I am trying to use ToolingAPI to fetch Pagelayout informations. As I am using lightning, so I have created
1.connected app:
2.Auth Provider:
Global with sharing class DocGeneration { @AuraEnabled public static String Callout(){; String resbody; Http http = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint('callout:Tooling_API/services/data/v35.0/tooling/query/?q=Select+Id+from+Layout'); req.setMethod('GET'); req.setHeader('Content-Type', 'application/json;charset=UTF-8'); system.debug('req:' + req); HttpResponse res = new HttpResponse(); res = http.send(req); resbody= res.getBody(); system.debug('res:' + resbody); return resbody; } }When I am calling this method from annonymous Apex in developer console, It is returning the status as 200 but HTTPResponse has no body.
Am I doing anything wrong? Please help.
I made some changes in your code. As I have ran the code in classic so I used my org's Instance url and ans Session Id as below and I got response in the assert.
You said you are also getting the code 200 which means your authentication is successfully performing. I would suggest you to assert the response and execute the code in execute annonymous.
Please try and let me know the results.
Regards
Ayush
All Answers
I made some changes in your code. As I have ran the code in classic so I used my org's Instance url and ans Session Id as below and I got response in the assert.
You said you are also getting the code 200 which means your authentication is successfully performing. I would suggest you to assert the response and execute the code in execute annonymous.
Please try and let me know the results.
Regards
Ayush
I can see the result but I am unable to store it in a string. Is there any way? Thanks in advance