GET /api/puppetclasses
List all Puppet classes

GET /api/hosts/:host_id/puppetclasses
List all Puppet classes for a host

GET /api/hostgroups/:hostgroup_id/puppetclasses
List all Puppet classes for a host group

GET /api/environments/:environment_id/puppetclasses
List all Puppet classes for an environment

Examples

GET /api/puppetclasses
200
{
  "total": 8,
  "subtotal": 8,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 298486374,
      "name": "apache",
      "module_name": "apache"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 638205575,
      "name": "auth",
      "module_name": "auth"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 980190962,
      "name": "base",
      "module_name": "base"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 51848956,
      "name": "chkmk",
      "module_name": "chkmk"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 113629430,
      "name": "git",
      "module_name": "git"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 1018350795,
      "name": "nagios",
      "module_name": "nagios"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 374648174,
      "name": "pam",
      "module_name": "pam"
    },
    {
      "created_at": "2018-11-15 19:01:27 UTC",
      "updated_at": "2018-11-15 19:01:27 UTC",
      "id": 281110143,
      "name": "vim",
      "module_name": "vim"
    }
  ]
}

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

ID of host

Validations:

  • Must be a String

hostgroup_id
optional

ID of host group

Validations:

  • Must be a String

environment_id
optional

ID of environment

Validations:

  • Must be a String

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
config_group string
environment string
host string
hostgroup string
key string
name string

GET /api/puppetclasses/:id
Show a Puppet class

GET /api/hosts/:host_id/puppetclasses/:id
Show a Puppet class for host

GET /api/hostgroups/:hostgroup_id/puppetclasses/:id
Show a Puppet class for a host group

GET /api/environments/:environment_id/puppetclasses/:id
Show a Puppet class for an environment

Examples

GET /api/hosts/host318/puppetclasses/1018350796
200
{
  "created_at": "2018-11-15 19:02:55 UTC",
  "updated_at": "2018-11-15 19:02:55 UTC",
  "id": 1018350796,
  "name": "class9",
  "module_name": "class9",
  "environments": [
    {
      "name": "environment11",
      "id": 687036938
    }
  ],
  "hostgroups": [],
  "smart_variables": [],
  "smart_class_parameters": []
}

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

ID of host

Validations:

  • Must be a String

hostgroup_id
optional

ID of host group

Validations:

  • Must be a String

environment_id
optional

ID of environment

Validations:

  • Must be a String

id
required

ID of Puppet class

Validations:

  • Must be a String


POST /api/puppetclasses
Create a Puppet class

Examples

POST /api/puppetclasses
{
  "puppetclass": {
    "name": "test_puppetclass",
    "lookup_keys_attributes": [
      {
        "key": "smart_variable1"
      }
    ]
  }
}
201
{
  "created_at": "2018-11-15 19:02:55 UTC",
  "updated_at": "2018-11-15 19:02:55 UTC",
  "id": 1018350796,
  "name": "test_puppetclass",
  "module_name": "test_puppetclass",
  "environments": [],
  "hostgroups": [],
  "smart_variables": [
    {
      "variable": "smart_variable1",
      "id": 1018350796
    }
  ],
  "smart_class_parameters": []
}

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

puppetclass
required

Validations:

  • Must be a Hash

puppetclass[name]
required

Validations:

  • Must be a String


PUT /api/puppetclasses/:id
Update a Puppet class

Examples

PUT /api/puppetclasses/1018350796
{
  "smart_class_parameter_ids": [],
  "puppetclass": {}
}
200
{
  "created_at": "2018-11-15 19:02:55 UTC",
  "updated_at": "2018-11-15 19:02:55 UTC",
  "id": 1018350796,
  "name": "class12",
  "module_name": "class12",
  "environments": [
    {
      "name": "environment14",
      "id": 687036938
    }
  ],
  "hostgroups": [],
  "smart_variables": [],
  "smart_class_parameters": [
    {
      "parameter": "param50",
      "id": 1018350796
    }
  ]
}

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 a String

puppetclass
required

Validations:

  • Must be a Hash

puppetclass[name]
optional

Validations:

  • Must be a String


DELETE /api/puppetclasses/:id
Delete a Puppet class

Examples

DELETE /api/puppetclasses/980190962-base
{
  "puppetclass": {}
}
200
{
  "id": 980190962,
  "name": "base",
  "created_at": "2018-11-15T19:01:27.674Z",
  "updated_at": "2018-11-15T19:01:27.674Z"
}

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 a String