If you want to use a command line alternative to the Swagger UI, or want to script
from a shell script, you can use cURL to work with the metric anomaly detection
API, the Probable Cause API, the Runbooks API, and the Event Management API.
About this task
CURL is a command line tool that you can use to work with the APIs. Follow the steps
to learn how to use it.
Note: Do not use cURL for probable cause authentication for endpoints under
/api/mime/classification
. For more information, see
Probable Cause API.
Procedure
-
Generate an API key:
-
Open the Netcool® Operations Insight® UI and click API Keys on the event management
Administration page.
-
Click New API key.
-
Enter a description for the key in API key description.
-
Specify which part of the event management API the key provides access to. Go to Permissions and ensure only those check boxes are selected that you want the key to provide access to. All APIs are selected by default. Clear the ones you do not want the API key to provide access to.
Important: Make a note of the APIs the key provides access to. For example, note it in the description you enter for the key. You cannot view or change which APIs were selected for the key later.
-
Click Generate. A new name and password are generated. Make a note of these values.
Important: The password is hidden by default. To view and be able to copy the password, set Display password to Show. Ensure you make a note of the password. For security reasons the password cannot be retrieved later. If you lose the password, you must delete the API key and generate a new one.
-
Click the icon next to Manage API keys to view the base URL for the API.
-
Run the cURL command with the "-u" option to send data with the generated API key:
curl -u <API Key Name>:<API Key Password>
For example, for
the
metric anomaly detection
API the command
can be:
curl -u "cfd95b7e-3bc7-4006-a4a8-a73a79c71255/cytmiffytryb:N//UllfJ1rMcB7Onm6QH/dI5Xpe0pWtE" -vX POST --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TenantID: cfd95b7e-3bc7-4006-a4a8-a73a79c71255" --data @$DATA_DIR/demo__metrics__training__20200901-0100__20201003-0500.json "https://${PROJECT}-${RELEASE}.apps.${SERVER}/metrics/api/1.0/metrics" --insecure
Where:
- ${PROJECT} is the Red Hat®
OpenShift® Container Platform project name, for example:
netcool
- ${RELEASE} is the release name, for example:
noi
- ${SERVER} is the server name, for example:
mymetrics.example.xyz.com
Note:
The following items need to be considered when using cURL:
- Runbook Automation does not support charsets other than UTF-8. If a header is specified defining
another charset, the call will fail. This is an example of a failing cURL
command:
curl (…) --header 'Content-Type: application/json; charset=usascii'
-
Runbook Automation does not support the HTTP header "Expect: 100-continue"
. If
the input you provide is larger than 1024 Bytes, some versions of cURL send this header by default
and you must turn it off. To do this, add the following header to your cURL command:
--header 'Expect:'
.