function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steve FarmerSteve Farmer 

Authentication using Postman

Hi,

I am trying to envoke an APEX class I wrote to retrieve cases using REST in Postman. I am unable to figure out how to authenticate to get a propper session established. I created the class in the sandbox. Any help would be appreciated.

Steve
@Karanraj@Karanraj
If you want to verify salesforce REST API, you can use the workbench tool, which contains the REST explorer which allows to GET or POST to your webservice. Follow the below steps
User-added image

If you want to try it PostMan, here is the some of the blog post contains step by step instructions
https://forceadventure.wordpress.com/2013/01/31/creating-a-custom-rest-api-in-salesforce/
http://www.mstsolutions.com/blog/content/testing-salesforce-web-service-using-postman-rest-client
http://kalyanlanka.blogspot.ca/2014/08/calling-apex-rest-service-using-postman.html
Amit Chaudhary 8Amit Chaudhary 8

Please check below post for same

Test Salesforce API by Postman Rest Client | Postman and Salesforce | Calling APEX Rest service using Postman| OAuth 2.0

1) http://amitsalesforce.blogspot.com/2017/06/test-salesforce-api-by-postman-rest.html

Let us know if this will help you
Nuevo9763Nuevo9763
Hi Amit,
can you please help me with this problem I am facing?
I tried to follow exact steps for Direct URL in the above link , I get 400 Bad request (The request cannot be fulfilled due to bad syntax).
Below is my POST request.
https://na35.salesforce.com/services/oauth2/token?grant_type=password&client_id=3MVG9szVa2RxsqBZ.1fdpVIoPft1WRAebdZUT*****************RFpa.xkpUlE7VZHvUwUPGxnPAag&client_secret=3271256955005527931&username=**********&password=**************
I used all url params corrcet I double-triple checked. password I used password_security token. No mistake in that.
May I know what can be the reason? This is my personal dev sandbox. What is wrong here? Anybody facing same issue?

For the second method using wizard can you please post  the complete url for CallBack URL, Auth URL and Access Token URL? I get the below error when using the wizard method.
When using wizard, I get the below error. Also I do not see the grant type drop down that is shown in your screen shots.
<OAuth>
<error>unsupported_grant_type</error>
<error_description>grant type not supported</error_description>
</OAuth>
My screen looks like below.
User-added image
Thanks,
MK7
 
Vijaya Raghava Reddy KVijaya Raghava Reddy K
@MK7
Your OAuth authorization end point is wrong.
You need to use the correct Salesforce OAuth endpoint when issuing authentication requests in your application. The primary OAuth endpoints are:
For authorization: https://login.salesforce.com/services/oauth2/authorize
For token requests: https://login.salesforce.com/services/oauth2/token
For revoking OAuth tokens: https://login.salesforce.com/services/oauth2/revoke

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_oauth_endpoints.htm
Lucas JordanLucas Jordan

Current as of August 2018 

I has some issues trying to get API access with postman in my sanbox organisation I was able to resolve my issues with the following details.

In options for Connected APP inside Salesforce Org set Callback URL to. https://www.getpostman.com/oauth2/callback

And with the following Oauth2 details

Grant Type: Authorization Code

Callback URL: https://www.getpostman.com/oauth2/callback

Auth URL: https://test.salesforce.com/services/oauth2/authorize

Access Token URL: https://test.salesforce.com/services/oauth2/token

Client ID: {Client ID}

Client Secret: {Client Secret}

Scope: {blank}

State: {blank}

Client Authentication: Send client credentials in body

Oracle APIOracle API
Thanks Lucas !!

I was facing the same issue. I followed your steps and able to fix my problem. 
Thanks for sharing valuable information.
Keep posting ..
Natalya Murphy 8Natalya Murphy 8
Thanks Lucas Jordan.  One other thing I had to do was UNCHECK the "Request access token locally" checkbox
Ashish FugatAshish Fugat
while generating token i'm getting below error -
error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

I have used these details
Grant Type: Authorization Code
Callback URL: https://www.getpostman.com/oauth2/callback
Auth URL: https://test.salesforce.com/services/oauth2/authorize
Access Token URL: https://test.salesforce.com/services/oauth2/token
Client ID: {MY Client ID}
Client Secret: {MY Client Secret}
Scope: {blank}
State: {blank}
Client Authentication: Send client credentials in body
Rekha Rani 5Rekha Rani 5
while generating the access token using Oauth 2.0 please don't give spaces after the AuthURL,Access Token URL,Client ID and  Client Secret:
Suraj Tripathi 47Suraj Tripathi 47
Hi Steve Farmer,
Here is the step-by-step process please follow the below link.
 
Link :- https://www.sfdcstop.com/2019/01/how-to-connect-to-salesforce-with.html



If you face any problem then post it.
Please mark it as the best answer if it helps you to fix the issue.

Thank you!

Regards,
Suraj Tripathi.