on 05-21-2025 08:10 AM
Working with the Incorta APIs can be a handy and extensible way to manage your workflow scheduling. Load plans represent a list or grouping of schemas. You could kick off an entire sequential workflow by initiating a load plan!
This article will touch on a script that will kick off a load plan. Be aware that there is also an endpoint to retrieve load plan status.
The second version of the API trades in the method of generating an API key (v1) with the option to use either Personal Access Tokens (PAT) or a Java Web Token (JWT). The PAT is generated through the Incorta Profile Manager, while the JWT is generated using a user-configured OAuth 2.0 authorization server. Since using the PAT is the default, we will showcase how to schedule a schema load utilizing that method.
Note: This capability is only available in the cloud, version 2023.4 and later.
To create a functioning script, you'll need the following:
All that needs to be done is to plug the above four variables into this script and run! Ensure that your cluster is connected when running this script.
# Your provided information
cluster_url = "<Enter cluster name here>"
tenant_name = "<Enter tenant name here>"
load_plan_name = "<Enter load plan name here>"
# API endpoint
endpoint = f"{cluster_url}/incorta/api/v2/{tenant_name}/load-plan/execute"
# Request headers
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {INCORTA_ACCESS_TOKEN}"
}
# Request body
payload = {
"loadPlanName": load_plan_name
}
def execute_load_plan():
try:
# Make the POST request
response = requests.post(endpoint, json=payload, headers=headers)
# Check if request was successful
response.raise_for_status()
# Return the response data
return response.json()
except requests.exceptions.HTTPError as err:
print(f"HTTP Error: {err}")
print(f"Response: {err.response.text}")
return None
except requests.exceptions.RequestException as err:
print(f"Error making request: {err}")
return None
# Execute the load plan
if __name__ == "__main__":
print(f"Executing load plan '{load_plan_name}' for tenant '{tenant_name}'...")
result = execute_load_plan()
if result:
print("Load plan execution request successful!")
print("Response:")
print(result)