Export and import runbooks

Export and import runbooks by sending requests to the HTTP API. You can use existing tools to send requests, for example cURL, Postman for Chrome, or RESTClient for Firefox.

Before you can send requests, you need to create an API key for authentication. See API Keys for instructions how to create an API key.

In addition, determine the host name part of your IBM Netcool Operations Insight user interface URL. The base URL for sending API requests has the format https://<netcool-operations-insight-hostname>, for example, https://netcool.apps.mycluster.mycompany.com.

When creating a runbook, an ID is automatically assigned to it. The ID is used when you create an Impact trigger to link the runbook to events that match a specific filter pattern. When you plan to export the runbook and import it later on (for example, to restore a backup version of the runbook after the runbook is removed), you must set the keepId parameter. The keepId parameter includes the runbook ID during the export. Setting this parameter helps ensure that the integrity of the Impact trigger can be preserved when the runbook is imported later on.

Depending on your certificate configuration, you might need to add the -k or --insecure options for the example curl commands.

Export Runbooks

The following two calls create output, which can be imported again.
Use the following API to export all runbooks (including runbook IDs):
GET api/v1/rba/runbooks?exportFormat=keepId
When enabling the option exportFormat via the query parameter, the usual output of the command is replaced by an array of JSON objects. These JSON objects can be used to create the runbooks by using the import API endpoint. The following call is an example:
curl -u <APIKeyUsername>:<APIKeyPassword> https://netcool.apps.mycluster.mycompany.com/api/v1/rba/runbooks?exportFormat=keepId
Replace <APIKeyUsername> with your username and <APIKeyPassword> with your password.
Use the following API to export a single runbook:
GET api/v1/rba/runbooks/<RunbookId>?exportFormat=keepId
Replace <RunbookId> with the ID of the runbook. You can retrieve this ID, for example, from the Edit Runbook window. The following call is an example:
curl -u <APIKeyUsername>:<APIKeyPassword> https://netcool.apps.mycluster.mycompany.com/api/v1/rba/runbooks/<RunbookId>?exportFormat=keepId > exportedRunbook.json
Replace <APIKeyUsername> with your username and <APIKeyPassword> with your password. Replace <RunbookId> with the ID of the runbook.

Import Runbooks

Use the following API to import runbooks:
POST api/v1/rba/runbooks/import
The following call is an example:
curl -H "Expect:" -H "Content-Type: application/json" -u <APIKeyUsername>:<APIKeyPassword> -d@./exportedRunbooks.json https://netcool.apps.mycluster.mycompany.com/api/v1/rba/runbooks/import
Replace <APIKeyUsername> with your username and <APIKeyPassword> with your password. Note: ./exportedRunbooks.json is the output file that is created from the previous example.
Note: If you previously exported a lot of runbooks (or very large runbooks), you might face the 1 MB upload limit of the Runbook API when trying to import them again. In this scenario, you can use the following command, utilizing jq, to split the exportedRunbooks.json into several files named exportedRunbooks.json.aa, exportedRunbooks.json.ab, and so on, with 100 runbooks per file. These files can then be imported separately, thereby circumventing the 1 MB limit:
cat exportedRunbooks.json | jq .[] -c | split -l 100 --filter='jq . -cs > $FILE' - exportedRunbooks.json.
Depending on the size of your runbooks, you might need to split your exportedRunbooks.json file up into even smaller chunks of runbooks. In this case, simply modify the -l 100 argument of the split command to an even smaller number of runbooks per file.

General Notes on export and import

  • Exporting runbooks returns the data of referenced automations inline. These automations are created new when the runbook is imported.
  • Import actions do not overwrite existing runbooks, automations, or both.
  • Exporting multiple runbooks at once will consolidate automations that are referenced by more than one runbook and only create the minimum necessary number of new automations.
  • Imported runbooks are in draft state and do not retain any kind of version, execution, or approval history. The user performing the import action is visible as the runbook creator.

For more information about creating an API key, see API Keys.

For more information about the API, see the Runbook Automation - API Documentation child page under Runbooks API.