3

Is it possible to connect one salesforce(EE) org to another salesforce(EE) org using REST API. Please Guide me and give related links.

1
  • is there any way you can provide an explanation as to what you want to achieve or why you want to do this? – Bart Nov 12 '13 at 10:52
5

Yes. The overall architecture, well.. depends.

You can do it by having an application outside the force.com platform, making REST API calls to Salesforce. You would be needing a Developer Edition org that will be serving as the application's identity endpoint.

  1. Get a Test DE.
  2. In the remote apps section, add a new app.
  3. Fill in O.Auth callback URL. Take the token and secret that Salesforce generates for you and hardcode it in your backend.
  4. Authorize the app to be used by both the EEs.
  5. Now you can make REST API calls to both the EEs and do your thing.
1
  • @erbdex you mentioned "...hardcode it in your backend..." have you any pointers to this? How would you do this? – Bart Nov 12 '13 at 9:43
2

You need To create a remote application if you want to call Your Org From other than Salesforce, like cURL, POSTMAN etc., if you want to call Salesforce instance From Salesforce then there will be no use of Remote Application, all you need is to construct a Well Structure Code, for example:

httprequest req= new httprequest();
req.setMethod('POST');   
req.setTimeout(60000);
req.setEndpoint('https://www.salesforce.com/services/Soap/u/22.0');
req.setHeader('Content-Type', 'text/xml;charset=UTF-8');

req.setHeader('SOAPAction', '""');
string body='<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"><Header/><Body><login xmlns="urn:partner.soap.sforce.com"><username>' +'mysfdc.com'+ '</username><password>' + 'mypassword'+ '</password></login></Body></Envelope>';

req.setBody(body);

httpresponse res=new httpresponse();
res=p.send(req);

Using this code you will obtain Status Code 200 and sessionid.

1
  • It uses Soap Envelope. Any example of pure rest implementation? – Pranay Jaiswal Aug 4 '15 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.