Foreman considers a domain and a DNS zone as the same thing. That is, if you are planning to manage a site where all the machines are of the form hostname.somewhere.com then the domain is somewhere.com. This allows Foreman to associate a puppet variable with a domain/site and automatically append this variable to all external node requests made by machines at that site.


GET /api/domains
List of domains

GET /api/subnets/:subnet_id/domains
List of domains per subnet

GET /api/locations/:location_id/domains
List of domains per location

GET /api/organizations/:organization_id/domains
List of domains per organization

Examples

GET /api/locations/447626439/domains
200
{
  "total": 2,
  "subtotal": 2,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "fullname": null,
      "created_at": "2022-03-29 08:25:48 UTC",
      "updated_at": "2022-03-29 08:25:48 UTC",
      "id": 22495316,
      "name": "mydomain.net",
      "dns_id": 113629430,
      "dns": null
    },
    {
      "fullname": "somewhere in yourdomain",
      "created_at": "2022-03-29 08:25:48 UTC",
      "updated_at": "2022-03-29 08:25:48 UTC",
      "id": 589326610,
      "name": "yourdomain.net",
      "dns_id": 113629430,
      "dns": null
    }
  ]
}

Params

Param name Description
subnet_id
optional

ID of subnet

Validations:

  • Must be a String

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. ‘

Maruku could not parse this XML/HTML: 
<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
fullname string
id integer
location string
location_id integer
name string
organization string
organization_id integer
params string

GET /api/domains/:id
Show a domain

Examples

GET /api/domains/22495316-mydomain-net
200
{
  "fullname": null,
  "created_at": "2022-03-29 08:25:48 UTC",
  "updated_at": "2022-03-29 08:25:48 UTC",
  "id": 22495316,
  "name": "mydomain.net",
  "dns_id": 113629430,
  "dns": {
    "name": "DNS Proxy",
    "id": 113629430,
    "url": "http://else.where:45671"
  },
  "subnets": [
    {
      "id": 980190962,
      "name": "one",
      "description": null,
      "network_address": "2.3.4.0/24"
    }
  ],
  "interfaces": [],
  "parameters": [
    {
      "priority": null,
      "created_at": "2022-03-29 08:25:48 UTC",
      "updated_at": "2022-03-29 08:25:48 UTC",
      "id": 665394701,
      "name": "parameter",
      "parameter_type": "string",
      "value": "value1"
    }
  ],
  "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

Numerical ID or domain name

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_parameters
optional

Display hidden parameter values

Validations:

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


POST /api/domains
Create a domain

The fullname field is used for human readability in reports and other pages that refer to domains, and also available as an external node parameter

Examples

POST /api/domains
{
  "organization_id": 447626439,
  "domain": {
    "name": "example682.com",
    "organization_ids": [
      447626439
    ],
    "location_ids": [
      447626442
    ]
  }
}
201
{
  "fullname": null,
  "created_at": "2022-03-29 08:57:57 UTC",
  "updated_at": "2022-03-29 08:57:57 UTC",
  "id": 759776771,
  "name": "example682.com",
  "dns_id": null,
  "dns": null,
  "subnets": [],
  "interfaces": [],
  "parameters": [],
  "locations": [
    {
      "id": 447626442,
      "name": "loc325",
      "title": "loc325",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626439,
      "name": "org308",
      "title": "org308",
      "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

domain
required

Validations:

  • Must be a Hash

domain[name]
required

The full DNS domain name

Validations:

  • Must be a String

domain[fullname]
optional , nil allowed

Description of the domain

Validations:

  • Must be a String

domain[dns_id]
optional , nil allowed

DNS proxy ID to use within this domain

Validations:

  • Must be a number.

domain[domain_parameters_attributes]
optional , nil allowed

Array of parameters (name, value)

Validations:

  • Must be an array of any type

domain[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

domain[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


PUT /api/domains/:id
Update a domain

Examples

PUT /api/domains/22495316-mydomain-net
{
  "domain": {
    "name": ""
  }
}
422
{
  "error": {
    "id": 22495316,
    "errors": {
      "name": [
        "can't be blank"
      ]
    },
    "full_messages": [
      "DNS domain 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 an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.

domain
required

Validations:

  • Must be a Hash

domain[name]
optional

The full DNS domain name

Validations:

  • Must be a String

domain[fullname]
optional , nil allowed

Description of the domain

Validations:

  • Must be a String

domain[dns_id]
optional , nil allowed

DNS proxy ID to use within this domain

Validations:

  • Must be a number.

domain[domain_parameters_attributes]
optional , nil allowed

Array of parameters (name, value)

Validations:

  • Must be an array of any type

domain[location_ids]
optional , nil allowed

REPLACE locations with given ids

Validations:

  • Must be an array of any type

domain[organization_ids]
optional , nil allowed

REPLACE organizations with given ids.

Validations:

  • Must be an array of any type


DELETE /api/domains/:id
Delete a domain

Examples

DELETE /api/domains/22495316-mydomain-net
{
  "domain": {}
}
200
{
  "id": 22495316,
  "name": "mydomain.net",
  "fullname": null,
  "created_at": "2022-03-29T09:02:28.165Z",
  "updated_at": "2022-03-29T09:02:28.165Z",
  "dns_id": 113629430
}

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.