GET /api/media
List all installation media

GET /api/operatingsystems/:operatingsystem_id/media
List all media for an operating system

GET /api/locations/:location_id/media
List all media per location

GET /api/organizations/:organization_id/media
List all media per organization

Examples

GET /api/media
200
{
  "total": 6,
  "subtotal": 6,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "path": "http://mirror.centos.org/centos/6.0/os/$arch",
      "os_family": null,
      "created_at": "2021-11-26 11:25:02 UTC",
      "updated_at": "2021-11-26 11:25:02 UTC",
      "id": 980190962,
      "name": "CentOS 5.4"
    },
    {
      "path": "http://firmware.fake-huawei.com",
      "os_family": null,
      "created_at": "2021-11-26 11:25:02 UTC",
      "updated_at": "2021-11-26 11:25:02 UTC",
      "id": 32055736,
      "name": "Huawei VRP 5"
    },
    {
      "path": "http://download.opensuse.org/distribution/$version/repo/oss",
      "os_family": null,
      "created_at": "2021-11-26 11:25:02 UTC",
      "updated_at": "2021-11-26 11:25:02 UTC",
      "id": 750842046,
      "name": "OpenSUSE"
    },
    {
      "path": "http://brsla01/vol/solgi_5.10/sol$minor_$release_$arch",
      "os_family": null,
      "created_at": "2021-11-26 11:25:02 UTC",
      "updated_at": "2021-11-26 11:25:02 UTC",
      "id": 442321401,
      "name": "Solaris 10"
    },
    {
      "path": "http://sg.archive.ubuntu.com",
      "os_family": null,
      "created_at": "2021-11-26 11:25:02 UTC",
      "updated_at": "2021-11-26 11:25:02 UTC",
      "id": 1011586618,
      "name": "Ubuntu Mirror"
    },
    {
      "path": "http://nothing.intersting.com",
      "os_family": null,
      "created_at": "2021-11-26 11:25:02 UTC",
      "updated_at": "2021-11-26 11:25:02 UTC",
      "id": 338446587,
      "name": "unused"
    }
  ]
}

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. ‘id 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
family string
location string
location_id integer
name string
organization string
organization_id integer
path string

GET /api/media/:id
Show a medium

Examples

GET /api/media/980190962-CentOS%205-4
200
{
  "path": "http://mirror.centos.org/centos/6.0/os/$arch",
  "os_family": null,
  "created_at": "2021-11-26 11:25:02 UTC",
  "updated_at": "2021-11-26 11:25:02 UTC",
  "id": 980190962,
  "name": "CentOS 5.4",
  "operatingsystems": [
    {
      "id": 309172073,
      "name": "centos",
      "title": "centos 5.3"
    },
    {
      "id": 1073012828,
      "name": "Redhat",
      "title": "RHEL 6.1"
    }
  ],
  "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/media
Create a medium

Examples

POST /api/media
{
  "medium": {
    "name": "new medium",
    "path": "scMVPDdOwj",
    "organization_ids": [
      114267492
    ]
  }
}
422
{
  "error": {
    "id": null,
    "errors": {
      "path": [
        "URL must be valid and schema must be one of http, https, ftp, and nfs"
      ]
    },
    "full_messages": [
      "Path URL must be valid and schema must be one of http, https, ftp, and nfs"
    ]
  }
}

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

medium
required

Validations:

  • Must be a Hash

medium[name]
required

Name of media

Validations:

  • Must be a String

medium[path]
required

The path to the medium, can be a URL or a valid NFS server (exclusive of the architecture).

for example http://mirror.centos.org/centos/$version/os/$arch where $arch will be substituted for the host’s actual OS architecture and $version, $major and $minor will be substituted for the version of the operating system.

Solaris and Debian media may also use $release.

Validations:

  • Must be a String

medium[os_family]
optional , nil allowed

Operating system family, available values: AIX, Altlinux, Archlinux, Coreos, Debian, Fcos, Freebsd, Gentoo, Junos, NXOS, Rancheros, Redhat, Rhcos, Solaris, Suse, VRP, Windows, Xenserver

Validations:

  • Must be a String

medium[operatingsystem_ids]
optional , nil allowed

Validations:

  • Must be an array of any type

medium[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

medium[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


PUT /api/media/:id
Update a medium

Examples

PUT /api/media/980190962
{
  "medium": {
    "name": ""
  }
}
422
{
  "error": {
    "id": 980190962,
    "errors": {
      "name": [
        "can't be blank"
      ]
    },
    "full_messages": [
      "Name can't be blank"
    ]
  }
}

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

medium
required

Validations:

  • Must be a Hash

medium[name]
optional

Name of media

Validations:

  • Must be a String

medium[path]
optional

The path to the medium, can be a URL or a valid NFS server (exclusive of the architecture).

for example http://mirror.centos.org/centos/$version/os/$arch where $arch will be substituted for the host’s actual OS architecture and $version, $major and $minor will be substituted for the version of the operating system.

Solaris and Debian media may also use $release.

Validations:

  • Must be a String

medium[os_family]
optional , nil allowed

Operating system family, available values: AIX, Altlinux, Archlinux, Coreos, Debian, Fcos, Freebsd, Gentoo, Junos, NXOS, Rancheros, Redhat, Rhcos, Solaris, Suse, VRP, Windows, Xenserver

Validations:

  • Must be a String

medium[operatingsystem_ids]
optional , nil allowed

Validations:

  • Must be an array of any type

medium[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

medium[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


DELETE /api/media/:id
Delete a medium

Examples

DELETE /api/media/338446587
{
  "medium": {}
}
200
{
  "id": 338446587,
  "name": "unused",
  "path": "http://nothing.intersting.com",
  "created_at": "2021-11-26T11:25:02.492Z",
  "updated_at": "2021-11-26T11:25:02.492Z",
  "media_path": null,
  "config_path": null,
  "image_path": null,
  "os_family": 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.