Step 1 :
----------
Create a connect app in salesforce side-
Setup-->Apps-->Connected Apps-->Click on "New".
Connected App Name = "PostManIntegration"
Contact Email="xxxx@gmail.com"
API (Enable OAuth Settings) :-
Enable OAuth Settings=True
Callback URL=https://www.getpostman.com/oauth2/callback
Selected OAuth Scopes="Move all Available OAuth Scopes from left to right".
Click on save button.
Step 2:
---------
Open Post man tool and set authorization.
Select Type = OAuth 2.0
Click on "Get New Access Token" button and fillout the details below-
Token Name =SFDCStage
Auth URL : https://ap4.salesforce.com/services/oauth2/authorize(note:target org details)
Access Token URL = https://ap4.salesforce.com/services/oauth2/token
Client ID =3MVG9YDQS5WtC11rGKIQRhZePOsBtn5nBh78IQfLbKyCCGflGeqtOOG6eQLxyCO7fWtVWd39LVFV7fMZKS4hW
(note: client id copy&paste from connected app)
Client Secret =6074728589680506029
(note: client Secret , copy&paste from connected app)
Grant Type = Authorization Code
click on "Request Token" button.
Once you click on "Request Token" button. new popup will be opened and ask salesforce credentials. Provide the same and say allow.
Headers :
----------
Key = Content-Type----->Value=application/json
Step 3 :
--------
Now its time to test our application. Create one apex class in same salesforce organization.
Apex Class Example:
--------
From Postman tool select "Get" method and past the below url
https://ap4.salesforce.com/services/apexrest/v1/getContacts/{Your account object id}.
Click on "Send button" and you could see the below output.
----------
Create a connect app in salesforce side-
Setup-->Apps-->Connected Apps-->Click on "New".
Connected App Name = "PostManIntegration"
Contact Email="xxxx@gmail.com"
API (Enable OAuth Settings) :-
Enable OAuth Settings=True
Callback URL=https://www.getpostman.com/oauth2/callback
Selected OAuth Scopes="Move all Available OAuth Scopes from left to right".
Click on save button.
Step 2:
---------
Open Post man tool and set authorization.
Select Type = OAuth 2.0
Click on "Get New Access Token" button and fillout the details below-
Token Name =SFDCStage
Auth URL : https://ap4.salesforce.com/services/oauth2/authorize(note:target org details)
Access Token URL = https://ap4.salesforce.com/services/oauth2/token
Client ID =3MVG9YDQS5WtC11rGKIQRhZePOsBtn5nBh78IQfLbKyCCGflGeqtOOG6eQLxyCO7fWtVWd39LVFV7fMZKS4hW
(note: client id copy&paste from connected app)
Client Secret =6074728589680506029
(note: client Secret , copy&paste from connected app)
Grant Type = Authorization Code
click on "Request Token" button.
Once you click on "Request Token" button. new popup will be opened and ask salesforce credentials. Provide the same and say allow.
Headers :
----------
Key = Content-Type----->Value=application/json
Step 3 :
--------
Now its time to test our application. Create one apex class in same salesforce organization.
Apex Class Example:
@RestResource(urlMapping='/v1/getContacts/*')
global with sharing class getContact {
@Httpget
global static list<contact> fetchAccount(){
RestRequest req = RestContext.request;
RestResponse res = Restcontext.response;
Id accId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
list<contact> lstcontact =[Select id,lastname,Email,leadsource from contact where Accountid=:accId];
return lstcontact ;
}
}
Step 4 :--------
From Postman tool select "Get" method and past the below url
https://ap4.salesforce.com/services/apexrest/v1/getContacts/{Your account object id}.
Click on "Send button" and you could see the below output.