Documentation

Job List API Endpoint

Make a GET request to this resource to retrieve the list of jobs.

GET /api/v2/jobs/
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
X-API-Time: 0.052s

The resulting data structure contains:

{
    "count": 99,
    "next": null,
    "previous": null,
    "results": [
        ...
    ]
}

The count field indicates the total number of jobs found for the given query. The next and previous fields provides links to additional results if there are more than will fit on a single page. The results list contains zero or more job records.

Results

Each job data structure includes the following fields:

  • id: Database ID for this job. (integer)
  • type: Data type for this job. (multiple choice)
    • job: Playbook Run
  • url: URL for this job. (string)
  • related: Data structure with URLs of related resources. (object)
  • summary_fields: Data structure with name/description for related resources. (object)
  • created: Timestamp when this job was created. (datetime)
  • modified: Timestamp when this job was last modified. (datetime)
  • name: (string)
  • description: (string)
  • unified_job_template: (field)
  • launch_type: (multiple choice)
    • manual: Manual
    • callback: Callback
    • scheduled: Scheduled
    • dependency: Dependency
  • status: (multiple choice)
    • new: New
    • pending: Pending
    • waiting: Waiting
    • running: Running
    • successful: Successful
    • failed: Failed
    • error: Error
    • canceled: Canceled
  • failed: (boolean)
  • started: (datetime)
  • finished: (datetime)
  • elapsed: (decimal)
  • job_explanation: (string)
  • job_type: (multiple choice)
    • run: Run
    • check: Check
    • scan: Scan
  • inventory: (field)
  • project: (field)
  • playbook: (string)
  • credential: (field)
  • cloud_credential: (field)
  • forks: (integer)
  • limit: (string)
  • verbosity: (multiple choice)
    • 0: 0 (Normal)
    • 1: 1 (Verbose)
    • 2: 2 (More Verbose)
    • 3: 3 (Debug)
    • 4: 4 (Connection Debug)
    • 5: 5 (WinRM Debug)
  • extra_vars: (string)
  • job_tags: (string)
  • force_handlers: (boolean)
  • skip_tags: (string)
  • start_at_task: (string)
  • job_template: (field)
  • passwords_needed_to_start: (field)
  • ask_variables_on_launch: (field)

Create Jobs

Make a POST request to this resource with the following job fields to create a new job:

  • name: (string, required)
  • description: (string, default=””)
  • job_type: (multiple choice, required)
    • run: Run (default)
    • check: Check
    • scan: Scan
  • inventory: (field, default=None)
  • project: (field, default=None)
  • playbook: (string, default=””)
  • credential: (field, default=None)
  • cloud_credential: (field, default=None)
  • forks: (integer, default=0)
  • limit: (string, default=””)
  • verbosity: (multiple choice)
    • 0: 0 (Normal) (default)
    • 1: 1 (Verbose)
    • 2: 2 (More Verbose)
    • 3: 3 (Debug)
    • 4: 4 (Connection Debug)
    • 5: 5 (WinRM Debug)
  • extra_vars: (string, default=””)
  • job_tags: (string, default=””)
  • force_handlers: (boolean, default=False)
  • skip_tags: (string, default=””)
  • start_at_task: (string, default=””)
  • job_template: (field, default=None)

If the job_template field is specified, any fields not explicitly provided for the new job (except name and description) will use the default values from the job template.

Note

As of Ansible Tower v3.1, making POST requests on the /jobs/ endpoint has been deprecated.

Reviewing the Options Endpoint

The Options Endpoint table offers a view of the Options for this endpoint. When viewing the endpoint in the browsable API, clicking the “Options” button gives you the raw JSON for the following:

name Job List
description # List Jobs: Make a GET request to this resource to retrieve the list of jobs.
renders
0 application/json
1 text/html
parses
0 application/json
added_in_version 1.2
actions
POST
name
type string
required
true
label name
max_length 512
description
type string
required
false
label description
default (Empty Text)
job_type
type multiple choice
required
true
label job type
default run
choices
0
0 run
1 Run
1
0 check
1 Check
2
0 scan
1 Scan
inventory
type field
required
false
default null
project
type field
required
false
default null
playbook
type string
required
false
label playbook
max_length 1024
default (Empty Text)
credential
type field
required
false
default null
cloud_credential
type field
required
false
default null
forks
type integer
required
false
label forks
default 0
limit
type string
required
false
label limit
max_length 1024
default (Empty Text)
verbosity
type multiple choice
required
false
label verbosity
default 0
choices
0
0 0
1 0 (Normal)
1
0 1
1 1 (Verbose)
2
0 2
1 2 (More Verbose)
3
0 3
1 3 (Debug)
4
0 4
1 4 (Connection Debug)
5
0 5
1 5 (WinRM Debug)
extra_vars
type string
required
false
label extra vars
default (Empty Text)
job_tags
type string
required
false
label job tags
max_length 1024
default (Empty Text)
force_handlers
type boolean
required
false
label force handlers
default
false
skip_tags
type string
required
false
label skip tags
max_length 1024
default (Empty Text)
start_at_task
type string
required
false
label start at task
max_length 1024
default (Empty Text)
job_template
type field
required
false
default null
GET
id
type integer
label ID
help_text Database ID for this job.
type
type multiple choice
help_text Data type for this job.
choices
0
0 job
1 Playbook Run
url
type string
help_text URL for this job.
related
type object
help_text Data structure with URLs of related resources.
summary_fields
type object
help_text Data structure with name/description for related resources.
created
type datetime
help_text Timestamp when this job was created.
modified
type datetime
help_text Timestamp when this job was last modified.
name
type string
label name
description
type string
label description
unified_job_template
type field
label unified job template
launch_type
type multiple choice
label launch type
choices
0
0 manual
1 Manual
1
0 callback
1 Callback
2
0 scheduled
1 Scheduled
3
0 dependency
1 Dependency
status
type multiple choice
label status
choices
0
0 new
1 New
1
0 pending
1 Pending
2
0 waiting
1 Waiting
3
0 running
1 Running
4
0 successful
1 Successful
5
0 failed
1 Failed
6
0 error
1 Error
7
0 canceled
1 Canceled
failed
type boolean
label failed
started
type datetime
label started
finished
type datetime
label finished
elapsed
type decimal
label elapsed
job_explanation
type string
label job explanation
job_type
type multiple choice
label job type
choices
0
0 run
1 Run
1
0 check
1 Check
2
0 scan
1 Scan
inventory
type field
project
type field
playbook
type string
label playbook
credential
type field
cloud_credential
type field
forks
type integer
label forks
limit
type string
label limit
verbosity
type multiple choice
label verbosity
choices
0
0 0
1 0 (Normal)
1
0 1
1 1 (Verbose)
2
0 2
1 2 (More Verbose)
3
0 3
1 3 (Debug)
4
0 4
1 4 (Connection Debug)
5
0 5
1 5 (WinRM Debug)
extra_vars
type string
label extra vars
job_tags
type string
label job tags
force_handlers
type boolean
label force handlers
skip_tags
type string
label skip tags
start_at_task
type string
label start at task
job_template
type field
passwords_needed_to_start
type field
ask_variables_on_launch
type field
types
0 job
search_fields
0 description
1 name