+ Start a Discussion
Anil DuttAnil Dutt 

HTTP Post from Apex


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();
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');