You need to sign in to do that
Don't have an account?
Shilpa Kamble
Not getting response of tooling API from Anonymous window.
Hi,
I am trting to use the tooling api, I want to check the result if I call the method from Anonymous window of developer console, I am not getting the response.
Please check the below code.
Thanks in advance!
I am trting to use the tooling api, I want to check the result if I call the method from Anonymous window of developer console, I am not getting the response.
Please check the below code.
public class APIHandler{ public void executeREST(){ system.debug('In executeREST'); HttpRequest req = new HttpRequest(); req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); req.setHeader('Content-Type', 'application/json'); req.setEndpoint('http://ap5.lightning.force.com/services/data/v42.0/tooling/sobjects/'); req.setMethod('GET'); Http h = new Http(); HttpResponse res = h.send(req); system.debug('req='+req); system.debug('response===='+res.getBody()); } }and the code for testing is as below:
APIHandler obj = new APIHandler(); obj.executeREST();but I am not getting the response, please guide me.
Thanks in advance!
- May I suggest you please refer the below link for reference.
- https://salesforce.stackexchange.com/questions/167546/developer-console-execute-anonymous-http-code414
hope it helps.Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.
Thanks
Rahul Kumar