Documentation

17. Job Template List API Endpoint

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

GET /api/v1/job_templates/
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
X-API-Time: 0.051s

The resulting data structure contains:

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

The count field indicates the total number of job templates 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 template records.

17.1. Results

Each job template data structure includes the following fields:

  • id: Database ID for this job template. (integer)
  • type: Data type for this job template. (multiple choice)
    • job_template: Job Template
  • url: URL for this job template. (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 template was created. (datetime)
  • modified: Timestamp when this job template was last modified. (datetime)
  • name: (string)
  • description: (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)
  • last_job_run: (datetime)
  • last_job_failed: (boolean)
  • has_schedules: (boolean)
  • next_job_run: (datetime)
  • status: (multiple choice)
    • new: New
    • pending: Pending
    • waiting: Waiting
    • running: Running
    • successful: Successful
    • failed: Failed
    • error: Error
    • canceled: Canceled
    • never updated: Never Updated
  • host_config_key: (string)
  • ask_variables_on_launch: (boolean)
  • survey_enabled: (boolean)
  • become_enabled: (boolean)

17.2. Create Job Templates

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

  • 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=””)
  • host_config_key: (string, default=””)
  • ask_variables_on_launch: (boolean, default=False)
  • survey_enabled: (boolean, default=False)
  • become_enabled: (boolean, default=False)

17.3. 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 Template List
description # List Job Templates: Make a GET request to this resource to retrieve the list of job templates.
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)
host_config_key
type string
required
false
label host config key
max_length 1024
default (Empty Text)
ask_variables_on_launch
type boolean
required
false
label ask variables on launch
default
false
survey_enabled
type boolean
required
false
label survey enabled
default
false
become_enabled
type boolean
required
false
label become enabled
default
false
GET
id
type integer
label ID
help_text Database ID for this job template.
type
type multiple choice
help_text Data type for this job template.
choices
0
0 job_template
1 Job Template
url
type string
help_text URL for this job template.
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 template was created.
modified
type datetime
help_text Timestamp when this job template was last modified.
name
type string
label name
description
type string
label description
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
last_job_run
type datetime
label last job run
last_job_failed
type boolean
label last job failed
has_schedules
type boolean
label has schedules
next_job_run
type datetime
label next job run
status
type multiple choice
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
8
0 never updated
1 Never Updated
host_config_key
type string
label host config key
ask_variables_on_launch
type boolean
label ask variables on launch
survey_enabled
type boolean
label survey enabled
become_enabled
type boolean
label become enabled
types
0 job_template
search_fields
0 description
1 name