POST
/
plugins
/
runbooks
/
connections
/
{name}
/
exec
curl --request POST \
  --url https://use.hoop.dev/api/plugins/runbooks/connections/{name}/exec \
  --header 'Content-Type: application/json' \
  --data '{
  "client_args": [
    "--verbose"
  ],
  "env_vars": {
    "envvar": "PASSWORD:MTIz",
    "filesystem": "SECRET_FILE:bXlzZWNyZXQ="
  },
  "file_name": "myrunbooks/run-backup.runbook.sql",
  "metadata": {},
  "parameters": {
    "amount": "10",
    "wallet_id": "6736"
  },
  "ref_hash": "20320ebbf9fc612256b67dc9e899bbd6e4745c77"
}'
{
  "execution_time": 5903,
  "exit_code": 1,
  "has_review": false,
  "output": "<string>",
  "output_status": "failed",
  "session_id": "5701046A-7B7A-4A78-ABB0-A24C95E6FE54",
  "truncated": false
}

Path Parameters

name
string
required

The name of the connection

Body

application/json
The request body resource
file_name
string
required

The relative path name of the runbook file from the git source

Example:

"myrunbooks/run-backup.runbook.sql"

client_args
string[]

Additional arguments to pass down to the connection

Example:
["--verbose"]
env_vars
object

Environment Variables that will be included in the runtime

  • { envvar:[env-key]: [base64-val] } - Expose the value as environment variable
  • { filesystem:[env-key]: [base64-val] } - Expose the value as a temporary file path creating the value in the filesystem
Example:
{
  "envvar": "PASSWORD:MTIz",
  "filesystem": "SECRET_FILE:bXlzZWNyZXQ="
}
metadata
object

Metadata attributes to add in the session

parameters
object

The parameters of the runbook. It must match with the declared attributes

Example:
{ "amount": "10", "wallet_id": "6736" }
ref_hash
string

The commit sha reference to obtain the file

Example:

"20320ebbf9fc612256b67dc9e899bbd6e4745c77"

Response

200
application/json
The execution has finished
execution_time
integer

The amount of time the execution took in miliseconds

Example:

5903

exit_code
integer

The shell exit code, any non zero code means an error

  • 0 - Linux success exit code
  • -2 - internal gateway code that means it was unable to obtain a valid exit code number from the agent outcome packet
  • 254 - internal agent code that means it was unable to obtain a valid exit code number from the process
Example:

1

has_review
boolean

Inform if the connection has review enabled

Example:

false

output
string

Output contains an utf-8 output containing the outcome of the ad-hoc execution

output_status
enum<string>

Status reports if the outcome of the execution

  • success - The execution was executed with success
  • failed - In case of internal error or when the agent returns an exit code greater than 0 or different than -2
  • running - The execution may still be running.
Available options:
success,
failed,
running
Example:

"failed"

session_id
string

Each execution creates a unique session id

Example:

"5701046A-7B7A-4A78-ABB0-A24C95E6FE54"

truncated
boolean

If the `output`` field is truncated or not

Example:

false