Querying Salesforce using SOQL
Code
Set your Polytomic API key as an environment variable:
This example covers three steps:
- Create a Salesforce Connection.
- Run a SOQL query on that Connection.
- Read the query results from Polytomic.
1. Create a Salesforce connection
The following request creates a Salesforce Connection. See the Salesforce connection configuration for the required fields.
cURL
Python
Typescript
Go
Salesforce Connections authenticate with OAuth. Open the URL returned in the auth_url field of the response to complete the flow.
OAuth redirection
By default, the API expects auth_url to open in a new browser window.
Set the optional redirect_url parameter in the request body to change
the redirect target.
2. Start a SOQL query
The following request starts a SOQL query on the Salesforce Connection. The results are available through the Polytomic API once the query completes.
cURL
Python
Typescript
Go
3. Read the query results
Poll the query endpoint until the status is done or failed, then read the results:
