Monday, March 2, 2015

Salesforce Calling web service after authentication

Request to Salesforce
The external App will need to make an HTTP Request with the following values:
• HTTP method: ‘POST’
• Endpoint URL: [Salesforce login domain] + ‘/services/oauth2/token’
• Body:
o username: [Salesfore user’s username]
o password: [Salesfore user’s password]
o client_id: [Salesforce Connected App’s Consumer Key]
o client_secret: [Salesforce Connected App’s Consumer Secret]
o grant_type : ‘password’

The Salesforce login domain will be either:
• https://login.salesforce.com - if interacting with the Production org
• https://test.salesforce.com - if interacting with a Sandbox org
Connected App for the Customer Sync



Sending Request for authentication
1.       Enter following
a.       URL Field :- /services/oauth2/token
b.      Body Field :-grant_type=password&client_id=YOUR_CONSUMER_KEY&client_secret=YOUR_CONSUMER_SECRET&username=YOUR_USER_NAME&password=YOUR_PASSWORD_WITH_SECURITY_TOKEN
c.       Click on ‘Headers’ button, enter following in headers field:-
Content-Type: application/x-www-form-urlencoded

Accept: application/json




Response
Using instance url and access token REST API need to be called
In response it will give