GET /api/hosts/:host_id/interfaces
List all interfaces for host

GET /api/domains/:domain_id/interfaces
List all interfaces for domain

GET /api/subnets/:subnet_id/interfaces
List all interfaces for subnet

Examples

GET /api/hosts/host652/interfaces
200
{
  "total": 3,
  "subtotal": 3,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "subnet_id": null,
      "subnet_name": null,
      "subnet6_id": null,
      "subnet6_name": null,
      "domain_id": null,
      "domain_name": null,
      "created_at": "2021-09-01 11:39:17 UTC",
      "updated_at": "2021-09-01 11:39:17 UTC",
      "managed": true,
      "identifier": null,
      "id": 3,
      "name": "host652",
      "ip": null,
      "ip6": null,
      "mac": null,
      "mtu": null,
      "fqdn": "host652",
      "primary": true,
      "provision": true,
      "type": "interface",
      "virtual": false
    },
    {
      "subnet_id": null,
      "subnet_name": null,
      "subnet6_id": null,
      "subnet6_name": null,
      "domain_id": null,
      "domain_name": null,
      "created_at": "2021-09-01 11:39:17 UTC",
      "updated_at": "2021-09-01 11:39:17 UTC",
      "managed": true,
      "identifier": "eth271",
      "id": 4,
      "name": null,
      "ip": "0.0.0.29",
      "ip6": null,
      "mac": "00:33:45:ab:00:46",
      "mtu": null,
      "fqdn": null,
      "primary": false,
      "provision": false,
      "type": "interface",
      "virtual": false
    },
    {
      "subnet_id": null,
      "subnet_name": null,
      "subnet6_id": null,
      "subnet6_name": null,
      "domain_id": null,
      "domain_name": null,
      "created_at": "2021-09-01 11:39:18 UTC",
      "updated_at": "2021-09-01 11:39:18 UTC",
      "managed": true,
      "identifier": "eth272",
      "id": 5,
      "name": null,
      "ip": "0.0.0.30",
      "ip6": null,
      "mac": "00:33:45:ab:00:47",
      "mtu": null,
      "fqdn": null,
      "primary": false,
      "provision": false,
      "type": "bond",
      "mode": "balance-rr",
      "attached_devices": "",
      "bond_options": "",
      "virtual": true
    }
  ]
}

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

host_id
required

ID or name of host

Validations:

  • Must be a String

domain_id
optional

ID or name of domain

Validations:

  • Must be a String

subnet_id
optional

ID or name of subnet

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$/.


GET /api/hosts/:host_id/interfaces/:id
Show an interface for host

Examples

GET /api/hosts/host2362/interfaces/11
200
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2021-09-01 14:14:03 UTC",
  "updated_at": "2021-09-01 14:14:03 UTC",
  "managed": true,
  "identifier": "eth924",
  "id": 11,
  "name": null,
  "ip": "0.0.0.203",
  "ip6": null,
  "mac": "00:33:45:ab:01:44",
  "mtu": null,
  "fqdn": null,
  "primary": false,
  "provision": false,
  "type": "interface",
  "virtual": false
}

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

host_id
required

ID or name of host

Validations:

  • Must be a String

id
required

ID or name of interface

Validations:

  • Must be a String


POST /api/hosts/:host_id/interfaces
Create an interface on a host

Examples

POST /api/hosts/host2361/interfaces
{
  "interface": {
    "name": "test.foreman.com",
    "ip": "10.0.1.1",
    "mac": "AA:AA:AA:AA:AA:AA",
    "username": "foo",
    "password": "bar",
    "provider": "IPMI",
    "type": "bmc",
    "ip6": "2001:db8::1"
  }
}
201
{
  "subnet_id": null,
  "subnet_name": null,
  "subnet6_id": null,
  "subnet6_name": null,
  "domain_id": null,
  "domain_name": null,
  "created_at": "2021-09-01 14:14:02 UTC",
  "updated_at": "2021-09-01 14:14:02 UTC",
  "managed": true,
  "identifier": null,
  "id": 9,
  "name": "test.foreman.com",
  "ip": "10.0.1.1",
  "ip6": "2001:db8::1",
  "mac": "aa:aa:aa:aa:aa:aa",
  "mtu": null,
  "fqdn": "test.foreman.com",
  "primary": false,
  "provision": false,
  "type": "bmc",
  "username": "foo",
  "provider": "IPMI",
  "virtual": false
}

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

host_id
required

ID or name of host

Validations:

  • Must be a String

interface
required

interface information

Validations:

  • Must be a Hash

interface[mac]
optional , nil allowed

MAC address of interface. Required for managed interfaces on bare metal.

Validations:

  • Must be a String

interface[ip]
optional , nil allowed

IPv4 address of interface

Validations:

  • Must be a String

interface[ip6]
optional , nil allowed

IPv6 address of interface

Validations:

  • Must be a String

interface[type]
optional , nil allowed

Interface type, e.g. bmc. Default is interface

Validations:

  • Must be one of: interface, bmc, bond, bridge.

interface[name]
optional , nil allowed

Interface’s DNS name

Validations:

  • Must be a String

interface[subnet_id]
optional , nil allowed

Foreman subnet ID of IPv4 interface

Validations:

  • Must be a number.

interface[subnet6_id]
optional , nil allowed

Foreman subnet ID of IPv6 interface

Validations:

  • Must be a number.

interface[domain_id]
optional , nil allowed

Foreman domain ID of interface. Required for primary interfaces on managed hosts.

Validations:

  • Must be a number.

interface[identifier]
optional , nil allowed

Device identifier, e.g. eth0 or eth1.1

Validations:

  • Must be a String

interface[managed]
optional , nil allowed

Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?

Validations:

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

interface[primary]
optional , nil allowed

Should this interface be used for constructing the FQDN of the host? Each managed hosts needs to have one primary interface.

Validations:

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

interface[provision]
optional , nil allowed

Should this interface be used for TFTP of PXELinux (or SSH for image-based hosts)? Each managed hosts needs to have one provision interface.

Validations:

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

interface[username]
optional , nil allowed

Only for BMC interfaces.

Validations:

  • Must be a String

interface[password]
optional , nil allowed

Only for BMC interfaces.

Validations:

  • Must be a String

interface[provider]
optional , nil allowed

Interface provider, e.g. IPMI. Only for BMC interfaces.

Validations:

  • Must be one of: IPMI, Redfish, SSH.

interface[virtual]
optional , nil allowed

Alias or VLAN device

Validations:

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

interface[tag]
optional , nil allowed

VLAN tag, this attribute has precedence over the subnet VLAN ID. Only for virtual interfaces.

Validations:

  • Must be a String

interface[mtu]
optional , nil allowed

MTU, this attribute has precedence over the subnet MTU.

Validations:

  • Must be a Integer

interface[attached_to]
optional , nil allowed

Identifier of the interface to which this interface belongs, e.g. eth1. Only for virtual interfaces.

Validations:

  • Must be a String

interface[mode]
optional , nil allowed

Bond mode of the interface, e.g. balance-rr. Only for bond interfaces.

Validations:

  • Must be one of: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.

interface[attached_devices]
optional , nil allowed

Identifiers of attached interfaces, e.g. ['eth1', 'eth2']. For bond interfaces those are the slaves. Only for bond and bridges interfaces.

Validations:

  • Must be an array of any type

interface[bond_options]
optional , nil allowed

Space separated options, e.g. miimon=100. Only for bond interfaces.

Validations:

  • Must be a String

interface[compute_attributes]
optional , nil allowed

Additional compute resource specific attributes for the interface.

Validations:

  • Must be a Hash


PUT /api/hosts/:host_id/interfaces/:id
Update a host's interface

Examples

POST /api/hosts/host2363/interfaces/15
{
  "interface": {
    "name": "test.foreman.com",
    "ip": "10.0.1.1",
    "mac": "AA:AA:AA:AA:AA:AA",
    "username": "foo",
    "password": "bar",
    "provider": "IPMI",
    "type": "bmc",
    "ip6": "2001:db8::1"
  }
}
422
{
  "error": {
    "id": 15,
    "errors": {
      "type": [
        "can't be changed once the interface is saved"
      ]
    },
    "full_messages": [
      "Type can't be changed once the interface is saved"
    ]
  }
}

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

host_id
required

ID or name of host

Validations:

  • Must be a String

id
required

ID of interface

Validations:

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

interface
required

interface information

Validations:

  • Must be a Hash

interface[mac]
optional , nil allowed

MAC address of interface. Required for managed interfaces on bare metal.

Validations:

  • Must be a String

interface[ip]
optional , nil allowed

IPv4 address of interface

Validations:

  • Must be a String

interface[ip6]
optional , nil allowed

IPv6 address of interface

Validations:

  • Must be a String

interface[type]
optional , nil allowed

Interface type, e.g. bmc. Default is interface

Validations:

  • Must be one of: interface, bmc, bond, bridge.

interface[name]
optional , nil allowed

Interface’s DNS name

Validations:

  • Must be a String

interface[subnet_id]
optional , nil allowed

Foreman subnet ID of IPv4 interface

Validations:

  • Must be a number.

interface[subnet6_id]
optional , nil allowed

Foreman subnet ID of IPv6 interface

Validations:

  • Must be a number.

interface[domain_id]
optional , nil allowed

Foreman domain ID of interface. Required for primary interfaces on managed hosts.

Validations:

  • Must be a number.

interface[identifier]
optional , nil allowed

Device identifier, e.g. eth0 or eth1.1

Validations:

  • Must be a String

interface[managed]
optional , nil allowed

Should this interface be managed via DHCP and DNS smart proxy and should it be configured during provisioning?

Validations:

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

interface[primary]
optional , nil allowed

Should this interface be used for constructing the FQDN of the host? Each managed hosts needs to have one primary interface.

Validations:

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

interface[provision]
optional , nil allowed

Should this interface be used for TFTP of PXELinux (or SSH for image-based hosts)? Each managed hosts needs to have one provision interface.

Validations:

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

interface[username]
optional , nil allowed

Only for BMC interfaces.

Validations:

  • Must be a String

interface[password]
optional , nil allowed

Only for BMC interfaces.

Validations:

  • Must be a String

interface[provider]
optional , nil allowed

Interface provider, e.g. IPMI. Only for BMC interfaces.

Validations:

  • Must be one of: IPMI, Redfish, SSH.

interface[virtual]
optional , nil allowed

Alias or VLAN device

Validations:

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

interface[tag]
optional , nil allowed

VLAN tag, this attribute has precedence over the subnet VLAN ID. Only for virtual interfaces.

Validations:

  • Must be a String

interface[mtu]
optional , nil allowed

MTU, this attribute has precedence over the subnet MTU.

Validations:

  • Must be a Integer

interface[attached_to]
optional , nil allowed

Identifier of the interface to which this interface belongs, e.g. eth1. Only for virtual interfaces.

Validations:

  • Must be a String

interface[mode]
optional , nil allowed

Bond mode of the interface, e.g. balance-rr. Only for bond interfaces.

Validations:

  • Must be one of: balance-rr, active-backup, balance-xor, broadcast, 802.3ad, balance-tlb, balance-alb.

interface[attached_devices]
optional , nil allowed

Identifiers of attached interfaces, e.g. ['eth1', 'eth2']. For bond interfaces those are the slaves. Only for bond and bridges interfaces.

Validations:

  • Must be an array of any type

interface[bond_options]
optional , nil allowed

Space separated options, e.g. miimon=100. Only for bond interfaces.

Validations:

  • Must be a String

interface[compute_attributes]
optional , nil allowed

Additional compute resource specific attributes for the interface.

Validations:

  • Must be a Hash


DELETE /api/hosts/:host_id/interfaces/:id
Delete a host's interface

Examples

DELETE /api/hosts/host2368/interfaces/29
{
  "interface": {}
}
200
{
  "id": 29,
  "mac": "00:33:45:ab:01:50",
  "ip": "0.0.0.215",
  "name": null,
  "host_id": 13,
  "subnet_id": null,
  "domain_id": null,
  "attrs": {},
  "created_at": "2021-09-01T14:14:06.084Z",
  "updated_at": "2021-09-01T14:14:06.084Z",
  "provider": null,
  "username": null,
  "password": null,
  "virtual": false,
  "link": true,
  "identifier": "eth936",
  "tag": "",
  "attached_to": "",
  "managed": true,
  "mode": "balance-rr",
  "attached_devices": "",
  "bond_options": "",
  "primary": false,
  "provision": false,
  "compute_attributes": {},
  "ip6": null,
  "subnet6_id": 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

host_id
required

ID or name of host

Validations:

  • Must be a String

id
required

ID of interface

Validations:

  • Must be a String