top of page

Call Salesforce API from Python

Updated: Jan 17, 2020

There are standard API from salesforce which can be called as webservice from 3rd party.

You can login into salesforce workbench and call/test the standard as well as the user defined webservices.

This blog is to show how you can call webservice from outside of salesforce. In this example, we will call "/services/data/v46.0/sobjects/ContentVersion" to download salesforce file to our local system.


First of all, create a connected app. Goto Setup-> App Manager -> Click "New Connected App".

Fill the form as below.

You can give your own callback url, otherwise as it is given below.

Copy the consumer Key and consumer secret, and save it somewhere. We gonna need both real soon.

Give it at least 10 minute to be available to use.

Now, we have created a connected app to salesforce, and this can be used to call salesforce webservice from outside of salesforce.


Security Token - We would require security token to access salesforce api. If you don't have your security token, you need to reset it, and a new token will be sent to your email id.

Click on Settings. Search "Reset My Security Token" in quick find box. Click on "Reset My Security Token".

Now Click on "Reset Security Token" button and wait for e-mail. You will receive a new security token.


Python Code -


If this doesn't work Write to me @

1,164 views1 comment

Recent Posts

See All

1 Comment

Sridhar NareshIT
Sridhar NareshIT
Dec 01, 2023

I appreciate how clearly you communicate complex ideas. It makes the content accessible to a wide audience. The way u explained Call Salesforce API from Python is very easy to understand.

bottom of page