on 08-23-2023 07:14 AM - edited on 08-25-2023 12:20 PM by Tristan
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.
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.
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)