cancel
Showing results for 
Search instead for 
Did you mean: 
JoeM
Community Manager
Community Manager

Introduction

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.

Enable Access for an Individual User

  1. As an Incorta Super User or a user with the SuperRole, sign in to the Incorta.
  2. In the Navigation bar, select Security.
  3. In the Action bar, select Users.
  4. Select the checkbox next to the user you want to enable public API access.
  5. Select Edit (pen icon) in the upper right corner of the Security page.
  6. In the Edit User drawer, select the Security tab.
  7. In the Developer Tool section, toggle Enable Public API.

Create a Personal Access Security Token

  1. Select 'Create a Personal Access Token'
  2. Give the token a name and an expiration date
  3. Copy the token and save it. This token can not be viewed at a later time. Instead, a new one will need to be created. 
JoeM_0-1747839853624.png

 

Preparing the Script

To create a functioning script, you'll need the following:

  1. Incorta URL - the core URL ending in ".com." Remove any sub-directories.
  2. Tenant - Can be found as part of your login page for Incorta 
  3. API Token - Can be copied from the above
  4. The schema names to be loaded

Let's Go

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)

 

Related Material

Load Plan Execution Endpoint

Execution Status Endpoint

Load Schema via APIv2

 

Best Practices Index
Best Practices

Just here to browse knowledge? This might help!

Contributors
Version history
Last update:
‎05-21-2025 08:10 AM
Updated by: