You need to sign in to do that
Don't have an account?
Gaurish Gopal Goel
Authentication Failed in HTTP Callout
I am making an HTTP Callout using Apex in which I am not getting authenticated.
There are two required parameters : username and api_key
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('whatever the url is');
req.setmethod(POST);
req.setheader('username','goelgaurish@gmail.com');
req.setheader('api_key','idsfiubsdkjrnwopeiurwoheoir12431);
HttpResponse res = h.send(req);
return res.getBody();
I am not able to get a success while authenticating. Please correct the code if I am missing something.
Hi Gaurish,
Try adding the future annotation.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_annotation_future.htm
Also, see the samples below,
http://wiki.developerforce.com/page/Apex_Web_Services_and_Callouts
Regards,
Ashish