Skip to main content
Splunk® SOAR (On-premises)

Python Playbook API Reference for Splunk SOAR (On-premises)

Splunk® SOAR (On-premises)
5.5.0
As of version 6.4.0, the visual editor for classic playbooks is no longer part of Splunk SOAR. Before upgrading, convert your classic playbooks to modern mode. Your classic playbooks will continue to run and you can view and edit them in the SOAR Python code editor.
For details, see:
This documentation does not apply to the most recent version of Splunk® SOAR (On-premises). For documentation on the most recent version, go to the latest release.

Session automation API

The Splunk SOAR (On-premises) Automation API allows security operations teams to develop detailed and precise automation strategies. Playbooks can serve many purposes, ranging from automating minimal investigative tasks that can speed up analysis to large-scale responses to a security breach. The following APIs are supported to leverage the capabilities of session automation using playbooks.

build_phantom_rest_url

Use the build_phantom_rest_url API to combine the Splunk SOAR (On-premises) base URL and the specific resource path, such as /rest/artifact.

The build_phantom_rest_url API is supported from within a custom function.

phantom.build_phantom_rest_url()
Expand

This sample uses the phantom.build_phantom_rest_url API.

get_base_url

Use the get_base_url API to retrieve the URL that points to your Splunk SOAR (On-premises) instance.

The get_base_url API is supported from within a custom function.

phantom.get_base_url()
Expand

This sample uses the phantom.get_base_url() API.

get_phantom_home

Use the get_phantom_home API to return the path to the Splunk SOAR (On-premises) home directory.

The get_phantom_home is supported from within a custom function.

phantom.get_phantom_home()

The following examples show the return values for the get_phantom_home API:

Thu Jan 03 2019 16:36:31 GMT-0800 (Pacific Standard Time): /home/username/directory_name

get_rest_base_url

Use the get_rest_base_url API to return the base URL to the REST API of your Splunk SOAR (On-premises) instance. This API works on all Splunk SOAR (On-premises) instances, regardless of installation type, or the base URL found in the in Company Settings.

The get_rest_base_url is supported from within a custom function.

phantom.get_rest_base_url()

The following examples show the return values for the get_rest_base_url API.showing the custom HTTPS port:

Thu Jan 03 2019 16:36:31 GMT-0800 (Pacific Standard Time): https://127.0.0.1:8443/rest/

requests

Use the requests API to interact with the Splunk SOAR (On-premises) platform through the REST API. By using phantom.requests instead of directly importing requests from site packages, you avoid the need to set the Splunk SOAR (On-premises) request headers by hand, meaning that you don't need to authenticate with the platform. For more information on how to use the requests package, see https://pypi.org/project/requests.

The requests API is supported from within a custom function.

phantom.requests
Expand

This sample uses the phantom.requests() API.

set_action_limit

Use set_action_limit in your playbook's on_start() block to set the maximum number of action calls that can be executed. The default is 50 action calls per container per Playbook. Each phantom.act() call can still result in multiple actions performed, resulting in more actions than this setting.

set_action_limit is not supported from within a custom function.

phantom.set_action_limit(limit)
Last modified on 12 August, 2024
Data access automation API   Vault automation API

This documentation applies to the following versions of Splunk® SOAR (On-premises): 5.5.0, 6.0.0, 6.0.1, 6.0.2, 6.1.0, 6.1.1, 6.2.0, 6.2.1, 6.2.2


Please expect delayed responses to documentation feedback while the team migrates content to a new system. We value your input and thank you for your patience as we work to provide you with an improved content experience!

Was this topic useful?







You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters