Examples

POST /api/job_templates
{
  "job_template": {
    "template": "This is a test template",
    "name": "RandomName",
    "provider_type": "ssh"
  }
}
201
{
  "description": null,
  "description_format": null,
  "created_at": "2023-03-02 21:03:33 UTC",
  "updated_at": "2023-03-02 21:03:33 UTC",
  "template": "This is a test template",
  "locked": false,
  "id": 1007981842,
  "name": "RandomName",
  "job_category": "Miscellaneous",
  "provider_type": "ssh",
  "snippet": false,
  "template_inputs": [],
  "effective_user": {
    "value": null,
    "current_user": false,
    "overridable": true
  },
  "locations": [],
  "organizations": []
}

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_template
required

Validations:

  • Hash

job_template[name]
required

Template name

Validations:

  • String

job_template[description]
optional , nil allowed

Validations:

  • String

job_template[job_category]
required

Job category

Validations:

  • String

job_template[description_format]
optional , nil allowed

This template is used to generate the description. Input values can be used using the syntax %{package}. You may also include the job category and template name using %{job_category} and %{template_name}.

Validations:

  • String

job_template[template]
required

Validations:

  • String

job_template[provider_type]
required

Provider type

Validations:

  • Must be one of: SSH, script.

job_template[snippet]
optional , nil allowed

Validations:

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

job_template[audit_comment]
optional , nil allowed

Validations:

  • String

job_template[locked]
optional , nil allowed

Whether or not the template is locked for editing

Validations:

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

job_template[effective_user_attributes]
optional , nil allowed

Effective user options

Validations:

  • Hash

job_template[effective_user_attributes][value]
optional , nil allowed

What user should be used to run the script (using sudo-like mechanisms)

Validations:

  • String

job_template[effective_user_attributes][overridable]
optional , nil allowed

Whether it should be allowed to override the effective user from the invocation form.

Validations:

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

job_template[effective_user_attributes][current_user]
optional , nil allowed

Whether the current user login should be used as the effective user

Validations:

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

job_template[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

job_template[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type