It’s been a long time I have not written anything on this platform. Today, we will talk about “Calling Salesforce REST API using Community User”. This is a process for PostMan, but you will get the idea 🙂
User setup for :Calling Salesforce REST API using Community User
First thing first. By default the community users profile are not allowed for API calls. So clone the community profile you want to update and add the below two permission under system permissions:
Assign the new profile to the user we are going to test with. Then allow this profile to the community you want to test with.
Now let’s create a Connected App and get the client id and secret.
Once these are done we are ready to jump on to PostMan.
PostMan Steps
First step in this ? You guessed it : Open PostMan.
On a new tab prepare the URL to be hit for access token. The access token URL for Community will be :
https://<Salesforce community URL>/services/oauth2/authorize?response_type=token&client_id=<client_id from connected app created above>&redirect_uri=<redirect URI mentioned in the connected app>
The resource URI to be access needs to be added to the Postman tab:
https://<Salesforce Instance URL>/services/data/v48.0/query?q=select+id+,name+from+account (This can be any resource you want to query)
Note: This is not the Community URL
Go to Authorization tab and select type = OAuth 2.0
Click “Get New Access Token” to get the below window and fill it like the below screen.
Once all good and you click on the request token button it will popup with the window to enter your credentials :
Now you have the access token for your use. Click Use token and the PostMan will create the required header for use and get the resources. See the below screen for reference.
Conclusion
This helps reduce few steps we had to do earlier. But unless you want to go through that pain, this should be quick to test the API’s out. Please share your thoughts on this post “Calling Salesforce REST API using Community User” and keep reading and sharing….
Leave a Reply