GET /api/job_invocations
List job invocations

Examples

GET /api/job_invocations
200
{
  "total": 3,
  "subtotal": 3,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "id": 107,
      "description": null,
      "job_category": "Job name 117",
      "targeting_id": 121,
      "status": 0,
      "start_at": null,
      "status_label": "succeeded",
      "ssh_user": null,
      "time_to_pickup": null,
      "dynflow_task": {
        "id": "ad2828a3-6bde-4f8b-b286-fa3059ebb3c1",
        "state": "stopped"
      },
      "succeeded": "N/A",
      "failed": "N/A",
      "pending": "N/A",
      "total": "N/A",
      "missing": 0
    },
    {
      "id": 106,
      "description": null,
      "job_category": "Job name 105",
      "targeting_id": 123,
      "status": 2,
      "start_at": null,
      "status_label": "queued",
      "ssh_user": null,
      "time_to_pickup": null,
      "dynflow_task": null,
      "succeeded": "N/A",
      "failed": "N/A",
      "pending": "N/A",
      "total": "N/A",
      "missing": 0
    },
    {
      "id": 105,
      "description": null,
      "job_category": "Job name 104",
      "targeting_id": 122,
      "status": 2,
      "start_at": null,
      "status_label": "queued",
      "ssh_user": null,
      "time_to_pickup": null,
      "dynflow_task": null,
      "succeeded": "N/A",
      "failed": "N/A",
      "pending": "N/A",
      "total": "N/A",
      "missing": 0
    }
  ]
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

search
optional

filter results

Validations:

  • String

order
optional

Sort and order by a searchable field, e.g. '<field> DESC'

Validations:

  • String

page
optional

Page number, starting at 1

Validations:

  • Must be a number.

per_page
optional

Number of results per page to return, 'all' to return all results

Validations:

  • Must match regular expression /\A([1-9]\d*|all)\Z$/.


GET /api/job_invocations/:id
Show job invocation

Examples

GET /api/job_invocations/137
200
{
  "id": 137,
  "description": null,
  "job_category": "Job name 143",
  "targeting_id": 151,
  "status": 0,
  "start_at": null,
  "status_label": "succeeded",
  "ssh_user": null,
  "time_to_pickup": null,
  "dynflow_task": {
    "id": "36bf4d9f-7275-454f-aaf5-87ed726729d0",
    "state": "stopped"
  },
  "succeeded": "N/A",
  "failed": "N/A",
  "pending": "N/A",
  "total": "N/A",
  "missing": 0,
  "targeting": {
    "bookmark_id": null,
    "search_query": "name = foo",
    "targeting_type": "static_query",
    "user_id": 988725812,
    "randomized_ordering": false,
    "hosts": []
  },
  "task": {
    "id": "36bf4d9f-7275-454f-aaf5-87ed726729d0",
    "state": "stopped"
  },
  "mode": "immediate"
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

host_status
optional

Show Job status for the hosts

Validations:

  • Must be one of: true, false, 1, 0.


POST /api/job_invocations
Create a job invocation

Examples

POST /api/job_invocations
{
  "job_invocation": {
    "feature": "remote_execution_feature_8",
    "host_ids": [
      132,
      133
    ]
  }
}
201
{
  "id": 188,
  "description": "Job template 181 with inputs Template input 59=\"''\"",
  "job_category": "Job name 186",
  "targeting_id": 212,
  "status": 3,
  "start_at": "2023-11-27 20:15:08 UTC",
  "status_label": "running",
  "ssh_user": null,
  "time_to_pickup": null,
  "dynflow_task": {
    "id": "57b07eed-db92-44a5-a98b-dcfb071bcff9",
    "state": "planned"
  },
  "succeeded": "N/A",
  "failed": "N/A",
  "pending": "N/A",
  "total": 2,
  "missing": 0,
  "targeting": {
    "bookmark_id": null,
    "search_query": "name ^ (host137, host138)",
    "targeting_type": "static_query",
    "user_id": 135138680,
    "randomized_ordering": null,
    "hosts": [
      {
        "name": "host137",
        "id": 132,
        "display_name": "host137"
      },
      {
        "name": "host138",
        "id": 133,
        "display_name": "host138"
      }
    ]
  },
  "task": {
    "id": "57b07eed-db92-44a5-a98b-dcfb071bcff9",
    "state": "planned"
  }
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

job_invocation
required

Validations:

  • Hash

job_invocation[job_template_id]
optional , nil allowed

The job template to use, parameter is required unless feature was specified

Validations:

  • String

job_invocation[targeting_type]
required

Invocation type, one of {“static_query”=>“Static Query”, “dynamic_query”=>“Dynamic Query”}

Validations:

  • String

job_invocation[randomized_ordering]
optional , nil allowed

Execute the jobs on hosts in randomized order

Validations:

  • Must be one of: true, false, 1, 0.

job_invocation[inputs]
optional , nil allowed

Inputs to use

Validations:

  • Hash

job_invocation[ssh]
optional , nil allowed

SSH provider specific options

Validations:

  • Hash

job_invocation[ssh][effective_user]
optional , nil allowed

What user should be used to run the script (using sudo-like mechanisms). Defaults to a template parameter or global setting.

Validations:

  • String

job_invocation[ssh][effective_user_password]
optional , nil allowed

Set password for effective user (using sudo-like mechanisms)

Validations:

  • String

job_invocation[ssh_user]
optional , nil allowed

Set SSH user

Validations:

  • String

job_invocation[password]
optional , nil allowed

Set SSH password

Validations:

  • String

job_invocation[key_passphrase]
optional , nil allowed

Set SSH key passphrase

Validations:

  • String

job_invocation[recurrence]
optional , nil allowed

Create a recurring job

Validations:

  • Hash

job_invocation[recurrence][cron_line]
optional , nil allowed

How often the job should occur, in the cron format

Validations:

  • String

job_invocation[recurrence][max_iteration]
optional , nil allowed

Repeat a maximum of N times

Validations:

  • Must be a number.

job_invocation[recurrence][end_time]
optional , nil allowed

Perform no more executions after this time

Validations:

  • DateTime

job_invocation[recurrence][purpose]
optional , nil allowed

Designation of a special purpose

Validations:

  • String

job_invocation[scheduling]
optional , nil allowed

Schedule the job to start at a later time

Validations:

  • Hash

job_invocation[scheduling][start_at]
optional , nil allowed

Schedule the job for a future time

Validations:

  • DateTime

job_invocation[scheduling][start_before]
optional , nil allowed

Indicates that the action should be cancelled if it cannot be started before this time.

Validations:

  • DateTime

job_invocation[concurrency_control]
optional , nil allowed

Control concurrency level and distribution over time

Validations:

  • Hash

job_invocation[concurrency_control][concurrency_level]
optional , nil allowed

Run at most N tasks at a time

Validations:

  • Integer

job_invocation[bookmark_id]
optional , nil allowed

Validations:

  • Integer

job_invocation[search_query]
optional , nil allowed

Validations:

  • String

job_invocation[description_format]
optional , nil allowed

Override the description format from the template for this invocation only

Validations:

  • String

job_invocation[execution_timeout_interval]
optional , nil allowed

Override the timeout interval from the template for this invocation only

Validations:

  • Integer

job_invocation[feature]
optional , nil allowed

Remote execution feature label that should be triggered, job template assigned to this feature will be used

Validations:

  • String

job_invocation[time_to_pickup]
optional , nil allowed

Override the global time to pickup interval for this invocation only

Validations:

  • Integer


GET /api/job_invocations/:id/hosts/:host_id
Get output for a host

Examples

GET /api/job_invocations/74/hosts/52
200
{
  "complete": false,
  "refresh": true,
  "output": [],
  "delayed": true,
  "start_at": null
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

host_id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

since
optional

Validations:

  • String


GET /api/job_invocations/:id/hosts/:host_id/raw
Get raw output for a host

Examples

GET /api/job_invocations/38/hosts/27/raw
200
{
  "complete": true,
  "refresh": false,
  "output": null
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

host_id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..


POST /api/job_invocations/:id/cancel
Cancel job invocation

Examples

POST /api/job_invocations/110/cancel
{
  "job_invocation": {}
}
200
{
  "cancelled": true,
  "id": 110
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

force
optional

Validations:

  • Must be one of: true, false, 1, 0.


POST /api/job_invocations/:id/rerun
Rerun job on failed hosts

Examples

POST /api/job_invocations/113/rerun
{
  "failed_only": true,
  "job_invocation": {}
}
201
{
  "id": 114,
  "targeting_id": 130,
  "job_category": "Job name 123",
  "task_id": "a40e38aa-9bb8-4d92-9b48-46d24d8e5f1d",
  "task_group_id": 4,
  "triggering_id": 4,
  "description": null,
  "concurrency_level": null,
  "time_span": null,
  "execution_timeout_interval": null,
  "password": null,
  "key_passphrase": null,
  "remote_execution_feature_id": null,
  "effective_user_password": null,
  "ssh_user": null,
  "time_to_pickup": null
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

failed_only
optional

Validations:

  • Must be one of: true, false, 1, 0.


GET /api/job_invocations/:id/outputs
Get outputs of hosts in a job

Examples

POST /api/job_invocations/3/outputs
{
  "search_query": "id = 4",
  "job_invocation": {}
}
200
{
  "outputs": [
    {
      "complete": true,
      "refresh": false,
      "output": [],
      "host_id": 4
    }
  ]
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Integer

id
required

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

search_query
optional

Validations:

  • string from 2 to 128 characters containing only alphanumeric characters, space, '_', '-' with no leading or trailing space..

since
optional

Validations:

  • String

raw
optional

Validations:

  • String