GET /api/ptables
List all partition tables

GET /api/operatingsystems/:operatingsystem_id/ptables
List all partition tables for an operating system

GET /api/locations/:location_id/ptables
List all partition tables per location

GET /api/organizations/:organization_id/ptables
List all partition tables per organization

Examples

GET /api/ptables
200
{
  "total": 2,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": "ptable154",
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "description": null,
      "os_family": "Redhat",
      "created_at": "2022-09-06 14:34:33 UTC",
      "updated_at": "2022-09-06 14:34:33 UTC",
      "name": "ptable154",
      "id": 1007981719
    }
  ]
}

Params

Param name Description
operatingsystem_id
optional

ID of operating system

Validations:

  • Must be a number.

location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

search
optional

filter results

Validations:

  • Must be a String

order
optional

Sort and order by a searchable field, e.g. '<field> DESC'

Validations:

  • Must be a String

page
optional

Page number, starting at 1

Validations:

  • Must be a number.

per_page
optional

Number of results per page to return, 'all' to return all results

Validations:

  • Must match regular expression /\A([1-9]\d*|all)\Z$/.

Search fields

Field name Type Possible values
default true, false
family string
id integer
layout text
location string
location_id integer
locked true, false
name string
organization string
organization_id integer
snippet true, false
template text
vendor string

GET /api/ptables/:id
Show a partition table

Examples

GET /api/ptables/1007981723-ptable158
200
{
  "layout": "zerombr\nclearpart --all    --initlabel\npart /boot --fstype ext3 --size=<%= 10 * 10 %> --asprimary\npart /     --fstype ext3 --size=1024 --grow\npart swap  --recommended",
  "locked": false,
  "description": null,
  "os_family": "Redhat",
  "created_at": "2022-09-06 14:34:33 UTC",
  "updated_at": "2022-09-06 14:34:33 UTC",
  "name": "ptable158",
  "id": 1007981723,
  "operatingsystems": [],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

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.


POST /api/ptables
Create a partition table

Examples

POST /api/ptables
{
  "name": "ptable_test",
  "layout": "d-i partman-auto/disk",
  "ptable": {
    "layout": "d-i partman-auto/disk",
    "name": "ptable_test"
  }
}
201
{
  "layout": "d-i partman-auto/disk",
  "locked": false,
  "description": null,
  "os_family": null,
  "created_at": "2022-09-06 14:34:33 UTC",
  "updated_at": "2022-09-06 14:34:33 UTC",
  "name": "ptable_test",
  "id": 1007981718,
  "operatingsystems": [],
  "locations": [],
  "organizations": []
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

ptable
required

Validations:

  • Must be a Hash

ptable[name]
required

Validations:

  • Must be a String

ptable[description]
optional , nil allowed

Validations:

  • Must be a String

ptable[layout]
required

Validations:

  • Must be a String

ptable[snippet]
optional , nil allowed

Validations:

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

ptable[audit_comment]
optional , nil allowed

Validations:

  • Must be a String

ptable[locked]
optional , nil allowed

Whether or not the template is locked for editing

Validations:

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

ptable[os_family]
optional , nil allowed

Validations:

  • Must be a String

ptable[operatingsystem_ids]
optional , nil allowed

Array of operating system IDs to associate with the partition table

Validations:

  • Must be an array of any type

ptable[host_ids]
optional , nil allowed

Array of host IDs to associate with the partition table

Validations:

  • Must be an array of any type

ptable[hostgroup_ids]
optional , nil allowed

Array of host group IDs to associate with the partition table

Validations:

  • Must be an array of any type

ptable[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

ptable[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


POST /api/ptables/import
Import a provisioning template

Examples

POST /api/ptables/import
{
  "ptable": {
    "name": "ptable164",
    "template": "b"
  }
}
201
{
  "template": "b",
  "snippet": false,
  "description": null,
  "id": 1007981732,
  "name": "ptable164",
  "template_kind_id": null,
  "created_at": "2022-09-06T14:34:33.976Z",
  "updated_at": "2022-09-06T14:34:33.995Z",
  "locked": false,
  "default": false,
  "vendor": null,
  "os_family": "Redhat"
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

ptable
required

Validations:

  • Must be a Hash

ptable[name]
optional

template name

Validations:

  • Must be a String

ptable[template]
optional

template contents including metadata

Validations:

  • Must be a String

ptable[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

ptable[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type

options
optional

Validations:

  • Must be a Hash

options[force]
optional , nil allowed

use if you want update locked templates

Validations:

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

options[associate]
optional , nil allowed

determines when the template should associate objects based on metadata, new means only when new template is being created, always means both for new and existing template which is only being updated, never ignores metadata

Validations:

  • Must be one of: new, always, never.

options[lock]
optional , nil allowed

lock imported templates (false by default)

Validations:

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

options[default]
optional , nil allowed

makes the template default meaning it will be automatically associated with newly created organizations and locations (false by default)

Validations:

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


GET /api/ptables/revision

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

version
optional

template version

Validations:

  • Must be a String


PUT /api/ptables/:id
Update a partition table

Examples

PUT /api/ptables/1007981722
{
  "ptable": {
    "layout": "new ptable layout"
  }
}
200
{
  "layout": "new ptable layout",
  "locked": false,
  "description": null,
  "os_family": "Redhat",
  "created_at": "2022-09-06 14:34:33 UTC",
  "updated_at": "2022-09-06 14:34:33 UTC",
  "name": "ptable157",
  "id": 1007981722,
  "operatingsystems": [],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String

ptable
required

Validations:

  • Must be a Hash

ptable[name]
optional

Validations:

  • Must be a String

ptable[description]
optional , nil allowed

Validations:

  • Must be a String

ptable[layout]
optional

Validations:

  • Must be a String

ptable[snippet]
optional , nil allowed

Validations:

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

ptable[audit_comment]
optional , nil allowed

Validations:

  • Must be a String

ptable[locked]
optional , nil allowed

Whether or not the template is locked for editing

Validations:

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

ptable[os_family]
optional , nil allowed

Validations:

  • Must be a String

ptable[operatingsystem_ids]
optional , nil allowed

Array of operating system IDs to associate with the partition table

Validations:

  • Must be an array of any type

ptable[host_ids]
optional , nil allowed

Array of host IDs to associate with the partition table

Validations:

  • Must be an array of any type

ptable[hostgroup_ids]
optional , nil allowed

Array of host group IDs to associate with the partition table

Validations:

  • Must be an array of any type

ptable[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

ptable[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


DELETE /api/ptables/:id
Delete a partition table

Examples

DELETE /api/ptables/1007981740-ptable170
{
  "ptable": {}
}
422
{
  "error": {
    "id": 1007981740,
    "errors": {
      "base": [
        "ptable170 is used by host513"
      ]
    },
    "full_messages": [
      "ptable170 is used by host513"
    ]
  }
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be a String


POST /api/ptables/:id/clone
Clone a template

Examples

POST /api/ptables/1007981716-ptable152/clone
{
  "ptable": {
    "name": "MyClone"
  }
}
201
{
  "name": "MyClone",
  "id": 1007981716,
  "template": "zerombr\nclearpart --all    --initlabel\npart /boot --fstype ext3 --size=<%= 10 * 10 %> --asprimary\npart /     --fstype ext3 --size=1024 --grow\npart swap  --recommended",
  "snippet": false,
  "template_kind_id": null,
  "created_at": "2022-09-06T14:34:32.999Z",
  "updated_at": "2022-09-06T14:34:33.020Z",
  "locked": false,
  "default": false,
  "vendor": null,
  "os_family": "Redhat",
  "description": null
}

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

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.

ptable
required

Validations:

  • Must be a Hash

ptable[name]
required

template name

Validations:

  • Must be a String


GET /api/ptables/:id/export
Export a partition template to ERB

Examples

GET /api/ptables/1007981742-ptable172/export
200
<%#
name: ptable172
snippet: false
model: Ptable
os_family: Redhat
organizations:
- Organization 1
locations:
- Location 1
-%>
zerombr
clearpart --all    --initlabel
part /boot --fstype ext3 --size=<%= 10 * 10 %> --asprimary
part /     --fstype ext3 --size=1024 --grow
part swap  --recommended

Params

Param name Description
location_id
optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
optional

Set the current organization context for the request

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.