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 and ordering. In this article, we will touch on a script that will kick off multiple schemas, Be aware there is also an endpoint to retrieve schema 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-1692735446602.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. 

 

 

import requests
incorta_url= {Insert Incorta URL here}
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {Insert PAT TOKEN here}"
}
#print(headers)
schema_request_payload = {
    "schemaNames": [{Insert Schema Name here},{Insert Schema Name here}],
    "loadSource": "FULL",
    "synchronous": True,
    "requestedTimeoutInMilliseconds": 0
}

#print(schema_request_payload)
schema = requests.post(incorta_url+"/incorta/api/v2/{INSERT TENANT NAME HERE}/schema/load", json=schema_request_payload, headers=headers)
print(schema.text)

 

 

Related Material

Best Practices Index
Best Practices

Just here to browse knowledge? This might help!

Contributors
Version history
Last update:
‎08-25-2023 12:20 PM
Updated by: