You need to sign in to do that
Don't have an account?
Charni Wiggins 9
REST API endpoint changed - how did I test within dev console?
We recently had a contractor develop a simple API for us, who has since left and the endpoint has changed. I believe I have changed the endpoint where I need to. Is it possible to trigger the API via the dev console to test it? I was thinking using execute anonymous window. Would appreciate any help, as an admin! Thank you
You can try the below code snippet in execute anonymous window
HttpRequest req = new HttpRequest();
req.setEndpoint('URL'); //Specify your URL here
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
The system.debug will give you the response in debug logs.
Note: Make sure that the URL you would specify as an end point is added to remote site settings of your Org (Click path : Setup > Quick find> Remote Site Settings> )
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
All Answers
You can try the below code snippet in execute anonymous window
HttpRequest req = new HttpRequest();
req.setEndpoint('URL'); //Specify your URL here
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
The system.debug will give you the response in debug logs.
Note: Make sure that the URL you would specify as an end point is added to remote site settings of your Org (Click path : Setup > Quick find> Remote Site Settings> )
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you