+ Start a Discussion
Anil DuttAnil Dutt 

HTTP Post from Apex

Hi,

i want to make a HTTP Post request from Apex class to send an complete Opportunity object to my remote site Action

Here is my code

 Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('http://itinerary.swiftsetup.com/ItineraryBuilder/SendItineraryEmail?op='+Opp);
req.setMethod('Post');
HttpResponse res = h.send(req);
 result = res.getBody();

but getting following error

Invalid HTTP method: Post

Thanks for your help

Jia HuJia Hu
try req.setMethod('POST');