Issue resolution API
The issue resolution API allows for the interaction with alerts, incidents and related artifacts.
Endpoint URLs
Issue resolution events API
$ROUTE/aiops/api/issue-resolution/v1/events/
Issue resolution alerts API
$ROUTE/aiops/api/issue-resolution/v1/alerts/
Issue resolution incidents API
$ROUTE/aiops/api/issue-resolution/v1/incidents
- Incident-state transition rules and restrictions
- When you update an incident state manually through the incident management API, some state transitions restrict which additional fields you can modify in the same request. To make sure correct interpretation by the system, follow the rules below.
- State transitions that do not allow ownership changes
- Some transitions require ownership to remain unchanged. If you include owner or team fields during these transitions, the system interprets the update as an ownership change, which is not allowed.
- State transitions that require ownership
- Some manual transitions require an assignment if the incident is currently unassigned. These transitions must include either owner or team.
For more information about utilizing Issue resolution incidents API to enrich an incident by using IBM Tivoli Netcool/Impact policy, see Enrich an incident using policies.
Authentication
The API uses Platform UI (Zen) authentication, so you either need a JWT token or ZenApiKey to be authenticated. The token or key is used to determine whether a user or service ID has access when you use the API.
Accessing the API with cURL
-
Log in to your cluster and authenticate your admin user credentials for running API commands:
-
Adjust the project (namespace) for your system:
NAMESPACE=cp4aiops -
Get the admin username and set it as an environment variable by running the following command
USER=$(oc -n $NAMESPACE get secret platform-auth-idp-credentials -o jsonpath='{.data.admin_username}' | base64 -d) -
Get the password for your admin username and set it as an environment variable by running the following command:
PASS=$(oc -n $NAMESPACE get secret platform-auth-idp-credentials -o jsonpath='{.data.admin_password}' | base64 -d)
Note: Two methods of authentication are available:-
JWT Bearer Token
This token is temporary and lasts about 4 hours.
-
Platform UI (ZenApiKey) API key
This key remains until deleted.
For more information about API authentication, see Accessing APIs
-
-
Set your authentication.
-
If you are using the Platform UI (ZenApiKey) API key option, encode your admin username and API key with Base64 encoding:
ZENAPIKEY=$(echo "<username>:<API_key>" | base64 -w 0); echo $ZENAPIKEY -
If you are using the JWT Bearer Token option, set the token as an environment variable. The following command uses variables that are set in the previous step:
TOKEN=$(curl -k -X POST https://$ROUTE/icp4d-api/v1/authorize -H "Content-Type: application/json" -d "{\"username\": \"$USER\",\"password\": \"$PASS\"}" 2>/dev/null|awk -F'"' '{print $(NF-1)}')
-
-
Run a command to access the API. For example, the following command uses cURL to access the issue resolution alerts API to load alert data:
-
By using the route and the Platform UI (ZenApiKey) API key option:
curl -k -v -X POST "https://${ROUTE}/aiops/api/issue-resolution/v1/alerts/" --header "Content-Type: application/json" --header "Authorization: ZenApiKey ${ZENAPIKEY}" --header 'X-TenantID: cfd95b7e-3bc7-4006-a4a8-a73a79c71255' --data @<FILEPATH/FILE>.jsonWhere
<FILEPATH/FILE>is the full path to the JSON file that includes your sample alert data to load. -
By using the route and the JWT Bearer Token option:
curl -k -v -X POST "https://${ROUTE}/aiops/api/issue-resolution/v1/alerts/" --header "Content-Type: application/json" --header "Authorization: Bearer ${TOKEN}" --header 'X-TenantID: cfd95b7e-3bc7-4006-a4a8-a73a79c71255' --data @<FILEPATH/FILE>.jsonWhere
<FILEPATH/FILE>is the full path to the JSON file that includes your sample alert data to load.
-