Before starting with API development for Salesforce, we need to ensure that all prerequisites are properly installed and configured, this will save lots of significant development time by avoiding environmental issues.
In this article, we will discuss the detailed steps on how to set up the environment for API Development in Salesforce with all prerequisites tools & permissions.
The very first tool that we will is “Postman API Client”. It is the most important tool for API development as it is the collaboration platform that allows sending REST & SOAP Requests quickly & easily. It also provides features to inspect API status code, response object, response time and much more.
“Postman API Client” is a must to have tool for any developer targeting API development across any platform or technology stack. In this article, we will look into API development for Salesforce specifically.
Download & Install “Postman API Client”
We can follow the steps below to download & install the “Postman API Client”-
Step 1
Google “getPostman.com” or visit the link “https://www.getpostman.com/”
Step 2
Click on “Download the App”
Step 3
Click on “Windows 64 bit”, this selection depends on the type of machine you are running it on.
Step 4
Save the “.exe” file to the disk location
Step 5
Run the “.exe” with admin privileges
Step 6
Wait until the installation is over.
Step 7
If you already have an account with Postman use it to sign in.
It is important to note that all the collections you created with Postman are saved to their cloud and can be accessed on any device across any part of the globe.
Step 8
OR you can create a new account to manage your collections.
Step 9
Once Postman Client is launched, you can create a new collection for your API queries by clicking “New Collection”
Step 10
Give the name to the collection lets’ call it “Salesforce APIs”
Step 11
Click the “Create” button to add the collection to the Postman Client.
Step 12
And we can see a new collection is added to the Postman Client.
Enable Salesforce User Permissions for API Access
Step 1
Search for “Users” under Setup
Step 2
Click on “Users” under Users Menu
Step 3
Look for the user profile you would like to enable API access. Let’s pick up “Bansal Prashant” who is also a “System Administrator”. Since this the admin profile so the “API Enabled” permission would be already enabled but we can still see the process on how we can reach it. Click “Edit” to edit the profile.
Step 4
Now if you scroll down the edit profile screen until you find a section called “Administrative Permissions”. Under “Administrative Permissions” we need to locate “API Enabled” permission and check it if it not already checked. This permission will enable API access for this User Profile and after that API request to Salesforce will go under User Authentication for this User Profile.
Reset Security Token
This step is optional for those who already have their security tokens, but if you don’t have it, you can follow the steps below-
Step 1
Under User Profile Menu at the top, click “Settings” the get to the User Personal Information Menu
Step 2
Under “My Personal Information” menu, click “Reset My Security Token”
Step 3
On the “Reset Security Token” screen, click “Reset Security Token” button
Step 4
This will send the email to the user’s registered email id with security token details
Step 5
If we analyze the email received from Salesforce we can see the subject as shown
Step 6
The user will receive the security token email from [email protected], so make sure you keep this email id safe from spam
Step 7
In the email, we will see the security token details as shown
Generate WSDL
WSDL is important for API Developers as it gives a quick reference about the existing metadata regarding the Salesforce Org. This reference could be extremely helpful when building API Calls which may call body, input parameters, filters, SOQL queries and much more.
We will see the steps to generate the WSDL file from the Salesforce schema. Make you generate WSDL file every time the Salesforces Org Metadata for updated to keep an updated reference for the development-
Step 1
Search for “API” under Setup
Step 2
Click “API” under integration section
Step 3
Since we are going to work with Salesforce Org within my organization so it is always a recommended approach to generate “Enterprise WSDL”. Click on “Generate Enterprise WSDL” link to launch “Generate Enterprise WSDL”screen
Step 4
Click on the “Generate” button to initiate the WSDL generation
Step 5
Soon enough you will see the WSDL launched in a browser window, where we can read the WSDL specifications & details
Step 6
You can save the WSDL detail in the file for the reference later
Step 7
It is a rather long file and get to the end in a couple of scrolls, scroll it down you would see the SObject metadata definitions for all Standard as well as Custom objects
I hope you enjoyed this article. Please leave your comments to let me know how you like the content and if you found it helpful to learn the topic.