When it comes to Integration with any other Technology we all have doubts like :
"How to Start ?" ,
"How to make your First API Call & see the Response ?"
The Answer is POSTMAN. With the help of this Tool you can easily make REST API Calls using its wonderful UI & can see Responses very well. Moreover it also helps you in understanding the Flow of Integeration.
INSTALLATION : https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
Once Installed.It will Look something like this -
Now Let me give you a Demonstration that will explain you a flow of REST API Integration of Salesforce with this POSTMAN(acting as a third party software).Your third Party Tool can be any , the Process will remain the same.
1.) Open POSTMAN -> Select Oauth 2.0 ( Authorization Framework ) from the Drop Down Picklist ->
->Click on Get New Access Token Button -> Copy the Callback URL
I will explain you later why i have copied this.For now just copy it.
2.) Now you need to Create a Connected App in Salesforce as the third Party(POSTMAN) is getting Integrated with it.For that
Go to your Salesforce Org -> Build -> Create -> Apps -> At the bottom you will see New Button.Click on it and fill details like this:
Now you can see where you need to fill the Callback URL.I will explain you later in the post what is the need of this Callback URL.
In Connected App Click Manage Button and Set - IP Relaxation To Relax IP restrictions
3.) After the Connected App gets created , Copy the Consumer Key , Consumer Secret and paste it in a Notepad.
4.) Now go to this link and Copy and paste these 2 https -
For authorization: https://login.salesforce.com/services/oauth2/authorize
For token requests: https://login.salesforce.com/services/oauth2/token
***NOTE - Replace login with your Salesforce Instance.
Now we all this in Notepad:
5.) Now Fill these :
and Click on Request Token.
6.) A Popup will open which will ask for login into your Salesforce Org in which Connected App is created.As soon as you enter your credentials you will be redirected to your POSTMAN (this is what Callback URL does - the URL where you will be redirected as soon as you will login into your Salesforce Org for Authorization).
7.) Now you will recieve you request token.
Then Click on Use Token Button.As soon as you click on this button, your Header will look something like this :
The digits written to the right of Bearer is the Access Token i.e ( Authorization = Bearer + Access Token ).
8.) Now in the Address Bar of POSTMAN Enter - https://ap2.salesforce.com/services/data/v39.0/sobjects/account
This is basically your Endpoint url. Replace ap2 with your salesforce Instance.
9.) Now Click on Send Button.As soon as you click send button you will get Response with all the Accounts (As you have requested /account in the url - https://ap2.salesforce.com/services/data/v39.0/sobjects/account).
Congratulations this third Party POSTMAN has been integrated with your salesforce.As on hitting the /account requests in this third Party POSTMAN , your'e getting your accounts.
So the Short Recipe for this is :
- First you will make a token call (https://login.salesforce.com/services/oauth2/token) with the Consumer Key & Consumer secret.
- Then you will recieve Request Token which you will add it in the header i.e [ Authorization = Bearer + Access Token ].
- Then you will make a REST API Call with Get method to the Endpoint url - https://ap2.salesforce.com/services/data/v39.0/sobjects/account . Replace ap2 with your salesforce Instance.Then you will get whatever you have requested.The Endpoint url - https://ap2.salesforce.com/services/ remains same till /services, after that it changes depending upon the Requirement.
- ***NOTE - Here your'e making GET Request (For getting any data from your Salesforce Org to your Third Party App- here POSTMAN).For POST Requests you will need to add Content-Type also in the Header like this -
Whatever you are Integrating with Salesforce in future, this Flow will remain Same.Always refer to the API Guides of the Application which you want to Integrate it with Salesforce.Read From start till End carefully , each & every Line.
KEEP CALM AND LOVE API's