Importing the Business Scopes using Knowledge Accelerators API
A project administrator can import each Knowledge Accelerators Business Scope into Watson Knowledge Catalog using an API call.
The following method sets a number of environment variables and calls the import_items API to import the business scopes directly into Watson Knowledge Catalog.
Requirements and permissions
- Offering plan
- You can add Knowledge Accelerators to your governance framework as part of the IBM Cloud Pak for Data platform.
- Required permissions
- You must have this
user permission to import the Knowledge Accelerators:
- Manage governance categories
Setting your environment variables
- Set your IBM Cloud Pak for Data URL, for example https://cpd-wkc.apps.host.company.com:
To check the value of the $CPD_URL variable, run this command:export CPD_URL={CPD_URL}
echo $CPD_URL
- Generate your token using your API_KEY. To get your API key, see Generating API
keys for authentication.
You should get output similar to:curl -k -X POST $CPD_URL/icp4d-api/v1/authorize -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{"username":"admin","api_key":"{API_KEY}"}'
{"_messageCode_":"200","message":"Success","token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1PamZFMGNVR2FFe..."}
- To set the TOKEN variable, copy and paste the token value into the following
command:
For example:export TOKEN={TOKEN}
export TOKEN=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1PamZFMGNVR2FFe...
To check the value of the TOKEN variable, run this command:echo $TOKEN
- Set the KA_IND variable for the Knowledge Accelerator industry, see Table 1
for {ka_id} values:
export KA_IND={ka_id}
To check the value of the KA_IND variable, run this command:Table 1. {ka_id} values for each industry Cross Industry Energy and Utilities Financial Services Healthcare Insurance kaci20
kaeu20
kafs20
kahc20
kain20
echo $KA_IND
- Set the KA_IDS variable for the single scope you want to import. Ensure you
select a scope from the industry you set in the previous step. See Table 2 for
{scope_id} values:
export KA_IDS={scope_id}
Note: Select only one business scope at a time.For a definition and more information on the content of each of the business scopes, see the following links:Table 2. {scope_id} values for each industry Cross Industry Energy and Utilities Financial Services Healthcare Insurance contact-center power-network-assets banking-customers clinical-order---imaging claim-management personal-data gas-network-assets credit-cards health-plan-product---features-and-benefits vehicle-accident weather-insights network-asset-measurements loans-and-mortgages patient-administration---adt vehicle-information utility-customer aml-suspicious-transactions patient-practitioner contact-information metering-and-usage-point credit-risk-mitigation personal-health-record---continuity-of-care customer-360 payments-data submitted-healthcare-claim party policy-management premium-management - Cross Industry Business Scopes available for separate import
- Energy and Utilities Business Scopes available for separate import
- Financial Services Business Scopes available for separate import
- Healthcare Business Scopes available for separate import
- Insurance Business Scopes available for separate import
echo $KA_IDS
Importing Business Scopes
You import each of the business scopes for a Knowledge Accelerator industry using the import_items API call.
- To check what is going to be imported in advance, run the following
command:
Result example:curl -X POST "$CPD_URL/v1/knowledge_accelerators/$KA_IND/import_items?ids=$KA_IDS&merge_option=all" -k -s -H "Authorization: Bearer $TOKEN"
{ "message": "KA004I: The import has been evaluated. If ready to import, please repeat call with the parameter do_import\u003dtrue.", "import_evaluation": { "knowledge_accelerator": "CPD_URL/v1/knowledge_accelerators/kaci20", "items": [ { "id": "personal-data", "evaluation": "import", "reason": "user_selected" } ] } }
- Import the selected Knowledge Accelerator Business Scope using the following command:
curl -X POST "$CPD_URL/v1/knowledge_accelerators/$KA_IND/import_items?ids=$KA_IDS&merge_option=all&do_import=true" -k -s -H "Authorization: Bearer $TOKEN"
{ "message": "The import has been submitted, please check url below for update status", "process_id": "CPD_URL/v3/governance_artifact_types/import/status /9ad7169b-adea-4a13-9e92-411b073934ae", "import_evaluation": { "knowledge_accelerator": "CPD_URL/v1/knowledge_accelerators/kaci20", "items": [ { "id": "personal-data", "evaluation": "import", "reason": "user_selected" } ] } }
Tip: Take note of the "process_id
" as you can use this to check the status of the import job.Note: The link that is listed in the response does not open in your browser as the bearer token is needed. Use the curl command from the Checking which Knowledge Accelerators are installed section to check the status of the import.
- To import another business scope, repeat steps 4 and 5 to set the KA_IND and KA_IDS variables.
Checking which Knowledge Accelerators are installed
curl -X GET "$CPD_URL/v1/knowledge_accelerators/import_items" -k -s -H "Authorization: Bearer $TOKEN"
This command returns a listing of any Knowledge Accelerator categories that are already imported into the Watson Knowledge Catalog instance.
{ "message": "KA008I: The following knowledge accelerator items are imported", "import_evaluation": [ { "knowledge_accelerator": "CPD_URL/v1/knowledge_accelerators/kaci20", "items": [ { "id": "personal-data", "evaluation": "imported_at_undeterminable_version", "latest_version": "2.0.20220520" } ] } ] }
Adding collaborators
You need to add collaborators to the Knowledge Accelerators categories, otherwise only the person who imports the accelerator can use the artifacts. See Managing access to a category for details on how to do this.
Optional import parameters
The following parameters can be changed in the POST import_items command:
- Mandatory query parameters
-
- merge_option [string]
- No default value so a value must be specified.
Value Description all Imported values replace existing values in catalog. specified Imported values that are not empty replace existing values in catalog. empty Imported values replace only empty values in catalog.
- Optional query parameters
-
- do_import [boolean]
- The default value is
false
.Value Description false Does all the logic checking and indicate what going to be imported, useful for checking in advance of doing the import. true At the end of logic checking, triggers the import and returns a process id to the user.