Skip to Content, PHP, MySQL, Javascript, Ajax, Htacces

Apex Callout

Be First!
by June 21, 2012 APEX
In short how to do an apex callout from Class..
Apex class:
global class with sharing ApexCallout{
public void callout()
//Construct a HTTP Request
HttpRequest req = new HttpRequest() ;
string strUrl=’**********Place your Remote Site Address here**********”;
//Before making this callout, you need to add Remote site address in the Remote Site Settings of your Organization..
//Setting Endpoint URL to HTTP request
//Set the request type
//HTTP object creation
Http http = new Http();
//Sending the Req throgh HTTPResponse object.
HTTPResponse res = http.send(req);
If you need to pass some parameters in the method, you can do it..
by changing the method to method with arguments.
You can call this method from trigger also..



Leave a Reply