You need to sign in to do that
Don't have an account?

Making HTTPS POST from salesforce and GET.
Hi...
I am having an REST URI of my client and i need to make some call outs to that from salesforce and POST some data...How can i do that?Its an integration between two orgs(salesforce and another third party tool)
Thanks,
Ramesh
Calling out from Salesforce to a third party RESTful web service is pretty straightforward - this article covers most of the basics: Apex Web Services and Callouts
You'll need to configure a Remote Site, then look at the HTTP Code Sample - that shows how to do a PUT against Amazon S3, but you can easily adapt it to a POST against another service.
Cheers,
Pat
But i heard we can do HTTP requests in two ways.
1.Using header(as said in your example of PUT)
2.Using API token/rest URI
I am trying to make POSTs using Token.
So my URI is http://my.target?key=7456423der3445445345543553552egsg3.
Also i have my logic/condition when the POST should happen and what fields should be posted to target and all...where should i include all that ??in the same HTTP class??
You can set up a form post like this - parameters are usually URL encoded in the body of the post:
Yes i have done something like this.I hardcoded xml format as body .
Snippet is like following,
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
string test = ' <some xml format data>';
req.setEndpoint('http://www.my-end-point.');
req.setMethod('POST');
req.setBody(test;)
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.getBody());
}
How can i get it dynamically????my xml data from salesforce.Thanks for your help sir.