GET /api/smart_variables
List all smart variables

GET /api/hosts/:host_id/smart_variables
List of smart variables for a specific host

GET /api/hostgroups/:hostgroup_id/smart_variables
List of smart variables for a specific host group

GET /api/puppetclasses/:puppetclass_id/smart_variables
List of smart variables for a specific Puppet class

Examples

GET /api/hostgroups/636252244-Common/smart_variables
200
{
  "total": 2,
  "subtotal": 2,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "description": null,
      "parameter_type": "boolean",
      "variable_type": "boolean",
      "hidden_value?": false,
      "validator_type": null,
      "validator_rule": null,
      "override_value_order": "fqdn\nhostgroup\nos\ndomain",
      "merge_overrides": false,
      "merge_default": false,
      "avoid_duplicates": false,
      "puppetclass_id": 980190962,
      "puppetclass_name": "base",
      "created_at": "2018-07-24 13:12:18 UTC",
      "updated_at": "2018-07-24 13:12:18 UTC",
      "variable": "bool_test",
      "id": 638205575,
      "default_value": "t",
      "override_values_count": 0
    },
    {
      "description": null,
      "parameter_type": "string",
      "variable_type": "string",
      "hidden_value?": false,
      "validator_type": "list",
      "validator_rule": "443,8443",
      "override_value_order": "fqdn\nhostgroup\nos\ndomain",
      "merge_overrides": false,
      "merge_default": false,
      "avoid_duplicates": false,
      "puppetclass_id": 980190962,
      "puppetclass_name": "base",
      "created_at": "2018-07-24 13:12:18 UTC",
      "updated_at": "2018-07-24 13:12:18 UTC",
      "variable": "ssl_port",
      "id": 298486374,
      "default_value": "443",
      "override_values_count": 1
    }
  ]
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

host_id
optional

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

hostgroup_id
optional

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

puppetclass_id
optional

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

show_hidden
optional

Display hidden values

Validations:

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

search
optional

filter results

Validations:

  • Must be a String

order
optional

Sort field and order, eg. ‘id DESC’

Validations:

  • Must be a String

page
optional

paginate results

Validations:

  • Must be a String

per_page
optional

number of entries per request

Validations:

  • Must be a String

Search fields

Field name Type Possible values
avoid_duplicates true, false
key string
merge_default true, false
merge_overrides true, false
override true, false
parameter string
puppetclass string

GET /api/smart_variables/:id
Show a smart variable

Examples

GET /api/puppetclasses/980190962/smart_variables/1018350798
200
{
  "description": null,
  "parameter_type": null,
  "variable_type": null,
  "hidden_value?": true,
  "validator_type": null,
  "validator_rule": null,
  "override_value_order": "fqdn\nhostgroup\nos\ndomain",
  "merge_overrides": false,
  "merge_default": false,
  "avoid_duplicates": false,
  "puppetclass_id": 980190962,
  "puppetclass_name": "base",
  "created_at": "2018-07-24 12:56:20 UTC",
  "updated_at": "2018-07-24 12:56:20 UTC",
  "variable": "param105",
  "id": 1018350798,
  "default_value": "*****",
  "override_values_count": 0,
  "override_values": []
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

show_hidden
optional

Display hidden values

Validations:

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


POST /api/smart_variables
Create a smart variable

Examples

POST /api/smart_variables
{
  "smart_variable": {
    "variable": "TgVpwLrCDf",
    "puppetclass_id": 298486374,
    "hidden_value": true
  }
}
201
{
  "description": null,
  "parameter_type": null,
  "variable_type": null,
  "hidden_value?": true,
  "validator_type": null,
  "validator_rule": null,
  "override_value_order": "fqdn\nhostgroup\nos\ndomain",
  "merge_overrides": false,
  "merge_default": false,
  "avoid_duplicates": false,
  "puppetclass_id": 298486374,
  "puppetclass_name": "apache",
  "created_at": "2018-07-24 12:56:20 UTC",
  "updated_at": "2018-07-24 12:56:20 UTC",
  "variable": "TgVpwLrCDf",
  "id": 1018350799,
  "default_value": "*****",
  "override_values_count": 0,
  "override_values": []
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

smart_variable
required

Validations:

  • Must be a Hash

smart_variable[variable]
required

Name of variable

Validations:

  • Must be a String

smart_variable[puppetclass_id]
optional , nil allowed

Puppet class ID

Validations:

  • Must be a number.

smart_variable[default_value]
optional , nil allowed

Default value of variable

Validations:

  • Must be one of types: string, boolean, integer, real, array, hash, yaml, json

smart_variable[hidden_value]
optional , nil allowed

When enabled the parameter is hidden in the UI

Validations:

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

smart_variable[override_value_order]
optional , nil allowed

The order in which values are resolved

Validations:

  • Must be a String

smart_variable[description]
optional , nil allowed

Description of variable

Validations:

  • Must be a String

smart_variable[validator_type]
optional , nil allowed

Types of validation values

Validations:

  • Must be one of: regexp, list.

smart_variable[validator_rule]
optional , nil allowed

Used to enforce certain values for the parameter values

Validations:

  • Must be a String

smart_variable[variable_type]
optional , nil allowed

Types of variable values

Validations:

  • Must be one of: string, boolean, integer, real, array, hash, yaml, json.

smart_variable[merge_overrides]
optional , nil allowed

Merge all matching values (only array/hash type)

Validations:

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

smart_variable[merge_default]
optional , nil allowed

Include default value when merging all matching values

Validations:

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

smart_variable[avoid_duplicates]
optional , nil allowed

Remove duplicate values (only array type)

Validations:

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


PUT /api/smart_variables/:id
Update a smart variable

Examples

PUT /api/smart_variables/1018350796-eziqgLwNpE
{
  "smart_variable": {
    "default_value": "IRhOjbsJAz"
  }
}
200
{
  "description": null,
  "parameter_type": null,
  "variable_type": null,
  "hidden_value?": true,
  "validator_type": null,
  "validator_rule": null,
  "override_value_order": "fqdn\nhostgroup\nos\ndomain",
  "merge_overrides": false,
  "merge_default": false,
  "avoid_duplicates": false,
  "puppetclass_id": 980190962,
  "puppetclass_name": "base",
  "created_at": "2018-07-24 12:56:20 UTC",
  "updated_at": "2018-07-24 12:56:20 UTC",
  "variable": "eziqgLwNpE",
  "id": 1018350796,
  "default_value": "*****",
  "override_values_count": 0,
  "override_values": []
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

smart_variable
required

Validations:

  • Must be a Hash

smart_variable[variable]
optional

Name of variable

Validations:

  • Must be a String

smart_variable[puppetclass_id]
optional , nil allowed

Puppet class ID

Validations:

  • Must be a number.

smart_variable[default_value]
optional , nil allowed

Default value of variable

Validations:

  • Must be one of types: string, boolean, integer, real, array, hash, yaml, json

smart_variable[hidden_value]
optional , nil allowed

When enabled the parameter is hidden in the UI

Validations:

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

smart_variable[override_value_order]
optional , nil allowed

The order in which values are resolved

Validations:

  • Must be a String

smart_variable[description]
optional , nil allowed

Description of variable

Validations:

  • Must be a String

smart_variable[validator_type]
optional , nil allowed

Types of validation values

Validations:

  • Must be one of: regexp, list.

smart_variable[validator_rule]
optional , nil allowed

Used to enforce certain values for the parameter values

Validations:

  • Must be a String

smart_variable[variable_type]
optional , nil allowed

Types of variable values

Validations:

  • Must be one of: string, boolean, integer, real, array, hash, yaml, json.

smart_variable[merge_overrides]
optional , nil allowed

Merge all matching values (only array/hash type)

Validations:

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

smart_variable[merge_default]
optional , nil allowed

Include default value when merging all matching values

Validations:

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

smart_variable[avoid_duplicates]
optional , nil allowed

Remove duplicate values (only array type)

Validations:

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


DELETE /api/smart_variables/:id
Delete a smart variable

Examples

DELETE /api/smart_variables/281110143-special_info
{
  "smart_variable": {}
}
200
{
  "description": null,
  "parameter_type": "string",
  "variable_type": "string",
  "hidden_value?": false,
  "validator_type": null,
  "validator_rule": null,
  "override_value_order": "organization,location\nxyz\nhostgroup",
  "merge_overrides": false,
  "merge_default": false,
  "avoid_duplicates": false,
  "puppetclass_id": 298486374,
  "puppetclass_name": "apache",
  "created_at": "2018-07-24 13:12:18 UTC",
  "updated_at": "2018-07-24 13:12:18 UTC",
  "variable": "special_info",
  "id": 281110143,
  "default_value": "secret",
  "override_values_count": 0,
  "override_values": []
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.