REST API
The Soda Cloud API enables you to trigger actions and query data in your Soda Cloud account.
Cloud EU:
Cloud US:
Use Soda Cloud's public API to:
connect Soda Cloud to your data catalog
trigger scheduled scans in Soda Cloud from within your data pipeline
access dataset and check info in Soda Cloud
access dataset responsibilities in Soda Cloud
access user and user groups in Soda Cloud
update datasets in Soda Cloud
update dataset responsibilities in Soda Cloud
update incidents in Soda Cloud
Connect to the Soda Cloud API
The following example demonstrates how to connect to the Soda Cloud API using Python.
Requirements
A Soda Cloud account
Python 3+
Recommended: A
.envfile containingAPI_KEY_IDandAPI_KEY_SECRETExample of.env:
## Replace the following with your credentials
API_KEY_ID=333c3c33-3c33-3c3c-cccc-3c3c3333c333
API_KEY_SECRET=CcC3cCC3C_CCCc33cCC3cCcCC333c_C3Cc3C333CC33cCCC--33cCcCLearn how to Generate API keys.
Example connection
You can use this example as a starting point for integrating Soda into your workflows, ensuring that you replace placeholders with your own credentials and project-specific details. In one .py file, you can:
Create a working session
Send a POST request
Send a GET request
## 1. Create a working session
from dotenv import load_dotenv
import os
import json
import requests
import base64
# (Recommended) Load environment variables from a .env file
load_dotenv()
api_key_id = os.getenv("API_KEY_ID")
api_key_secret = os.getenv("API_KEY_SECRET")
# Create token from your credentials
TOKEN = base64.b64encode(f"{api_key_id}:{api_key_secret}".encode()).decode()
HOST = "cloud.us.soda.io" # Or "cloud.soda.io"
HEADERS = {"Authorization": f"Basic {TOKEN}", "Content-Type": "application/json"}
datasetId = "<YOUR_DATASET_ID>" # Replace with your details
data = {"key": "value", "key2": "value2"} # Replace with your details## 2. Send a POST request to create or update data for the specified dataset
response = requests.post(
f"https://{HOST}/api/v1/datasets/{datasetId}",
headers=HEADERS,
json=data
)
print(response.json())## 3. Send a GET request to retrieve check results or details
response = requests.get(
f"https://{HOST}/api/v1/checks",
headers=HEADERS,
params={"checkIds": ["abcd"]} ## (optional) Replace with your details
)
print(response.json())Last updated
Was this helpful?
