Salesforce Working with External Systems Making an outbound callout


This is an example on how to call a web service from salesforce. The code below is calling a REST based service hosted on to find farmers markets close to the zipcode.

Please remember in order to invoke a HTTP callout from your org, you need to tweak the remote settings for the org.

string url= '';
Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
res = h.send(req);
System.Debug('response body '+res.getBody());