Skip to main content

API

Triggering Playbook run

A run can be triggered manually using our REST API

POST /playbook/run

Request Body Parameters

ParameterTypeDescription
idstringThe ID of the playbook to run.
check_idstringThe ID of the check to run the playbook against.
config_idstringThe ID of the config item to run the playbook against.
component_idstringThe ID of the component to run the playbook against.
paramsmap[string]stringThe parameters to pass to the playbook.

Response

FieldTypeDescription
run_idstringThe ID of the run.
starts_atstringThe time the run is scheduled to start (in RFC3339)

Example

Considering the playbook spec in quickstart, we can trigger a run as follows:

curl -sL -X POST -u 'admin@local:admin' \
--json '{
"id": "1e624351-2e7c-4afd-a038-8b0fc9e179ef",
"config_id": "0189f7b0-e0c7-944f-1f86-3e554392fd2b",
"params": {
"replicas": "1"
}
}' \
localhost:8080/playbook/run

Listing playbooks

As Playbooks are defined for components, checks and config items, it is possible to list what playbooks are available them. This filtering of playbooks is done by the ResourceFilter in the PlaybookSpec object.

POST `/playbook/list?config_id={config_id}`
POST `/playbook/list?check_id={check_id}`
POST `/playbook/list?component_id={component_id}`

Query Parameters

!!! info "Info"

Should provide exactly one of the parameters.
ParameterDescriptionType
config_idID of the config itemstring
check_idID of the Checkstring
component_idID of the component itemstring

Response

Returns a list of Playbook

FieldDescriptionType
idIDuuid
nameNamestring
specSpecjson
sourceSourcestring
created_byCreated Byuuid
created_atCreated Attime.Time
updated_atUpdated Attime.Time
deleted_atDeleted Attime.Time

Example

curl -sL -u 'admin@local:admin' \
'localhost:8080/playbook/list?config_id=0189f7b0-e0d9-a174-7837-ad255ff9834f'

curl -sL -u 'admin@local:admin' \
'localhost:8080/playbook/list?component_id=0188e1a5-1928-c829-b6c7-bf49d4a1fd52'

Approving a run

POST /playbook/run/approve/{playbook_id}/{run_id}

Path Parameters

ParameterTypeDescription
playbook_idstringThe ID of the playbook.
run_idstringThe ID of the run.

Example

curl -sL -X POST -u 'admin@local:admin' \
'localhost:8080/playbook/run/approve/<playbook_id/<run_id>'

Getting a run status

As a playbook run might take some time to complete, it is useful to know the status of the run.

GET /playbook/run/{id}

Path Parameters

ParameterTypeDescription
idstringThe ID of the playbook run.

Response

FieldTypeDescription
idstringThe ID of the run.
playbook_idstringThe ID of the playbook.
statusstringThe status of the run.
created_atstringThe time the run is scheduled to start (in RFC3339)
start_timestringThe time the run started (in RFC3339)
end_timestringThe time the run ended (in RFC3339)
created_bystringThe ID of the user that created the run.
component_idstringThe ID of the component that ran the playbook.
config_idstringThe ID of the config item that ran the playbook.
parametersmap[string]stringThe parameters to pass to the playbook.
agent_idstringThe ID of the agent that ran the playbook.

Accessing Artifacts

Mission control provides API endpoints to list and download the artifacts generated by playbooks. Artifacts are tied to the run that generated them.

Listing artifacts

/artifacts/list/playbook_run/:run_id

Downloading artifacts

/artifacts/download/:artifact_id