GET /api/locations
List all locations

Examples

GET /api/locations
200
{
  "total": 2,
  "subtotal": 2,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "locations": [
    {
      "ancestry": null,
      "parent_id": null,
      "parent_name": null,
      "created_at": "2022-09-06 15:00:55 UTC",
      "updated_at": "2022-09-06 15:00:55 UTC",
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    },
    {
      "ancestry": null,
      "parent_id": null,
      "parent_name": null,
      "created_at": "2022-09-06 15:00:55 UTC",
      "updated_at": "2022-09-06 15:00:55 UTC",
      "id": 373111740,
      "name": "Location 2",
      "title": "Location 2",
      "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

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
description text
id integer
location_id integer
name string
title string

GET /api/locations/:id
Show a location

Examples

GET /api/locations/447626540
200
{
  "select_all_types": [],
  "description": null,
  "created_at": "2022-09-06 15:11:37 UTC",
  "updated_at": "2022-09-06 15:11:37 UTC",
  "ancestry": null,
  "parent_id": null,
  "parent_name": null,
  "id": 447626540,
  "name": "loc387",
  "title": "loc387",
  "users": [],
  "smart_proxies": [],
  "subnets": [],
  "compute_resources": [],
  "media": [],
  "ptables": [],
  "provisioning_templates": [],
  "domains": [],
  "realms": [],
  "hostgroups": [],
  "organizations": [],
  "hosts_count": 0,
  "parameters": [
    {
      "priority": 20,
      "created_at": "2022-09-06 15:11:37 UTC",
      "updated_at": "2022-09-06 15:11:37 UTC",
      "id": 767575239,
      "name": "foo",
      "parameter_type": "string",
      "value": "bar"
    }
  ],
  "deprecations": {
    "environments": "Environments got deprecated from this endpoint."
  }
}

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

show_hidden_parameters
optional

Display hidden parameter values

Validations:

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

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/locations
Create a location

Examples

POST /api/locations
{
  "location": {}
}
422
{
  "error": {
    "id": null,
    "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

location
required

Validations:

  • Must be a Hash

location[name]
required

Validations:

  • Must be a String

location[description]
optional , nil allowed

Validations:

  • Must be a String

location[user_ids]
optional , nil allowed

User IDs

Validations:

  • Must be an array of any type

location[smart_proxy_ids]
optional , nil allowed

Smart proxy IDs

Validations:

  • Must be an array of any type

location[compute_resource_ids]
optional , nil allowed

Compute resource IDs

Validations:

  • Must be an array of any type

location[medium_ids]
optional , nil allowed

Medium IDs

Validations:

  • Must be an array of any type

location[ptable_ids]
optional , nil allowed

Partition template IDs

Validations:

  • Must be an array of any type

location[provisioning_template_ids]
optional , nil allowed

Provisioning template IDs

Validations:

  • Must be an array of any type

location[domain_ids]
optional , nil allowed

Domain IDs

Validations:

  • Must be an array of any type

location[realm_ids]
optional , nil allowed

Realm IDs

Validations:

  • Must be an array of any type

location[hostgroup_ids]
optional , nil allowed

Host group IDs

Validations:

  • Must be an array of any type

location[environment_ids]
optional , nil allowed

Environment IDs

Validations:

  • Must be an array of any type

location[subnet_ids]
optional , nil allowed

Subnet IDs

Validations:

  • Must be an array of any type

location[parent_id]
optional , nil allowed

Parent ID

Validations:

  • Must be a number.

location[ignore_types]
optional , nil allowed

List of resources types that will be automatically associated

Validations:

  • Must be an array of any type

location[organization_ids]
optional , nil allowed

Associated organization IDs

Validations:

  • Must be an array of any type


PUT /api/locations/:id
Update a location

Examples

PUT /api/locations/255093256-Location%201
{
  "location": {
    "domain_ids": [
      22495316,
      589326610,
      759776763,
      229305443
    ]
  }
}
200
{
  "select_all_types": [
    "Hostgroup",
    "User",
    "Medium",
    "Subnet",
    "SmartProxy",
    "ProvisioningTemplate",
    "ComputeResource",
    "Realm"
  ],
  "description": null,
  "created_at": "2022-09-06 15:15:23 UTC",
  "updated_at": "2022-09-06 15:15:48 UTC",
  "ancestry": null,
  "parent_id": null,
  "parent_name": null,
  "id": 255093256,
  "name": "Location 1",
  "title": "Location 1",
  "users": [
    {
      "id": 980190962,
      "login": "one",
      "description": null,
      "inherited": false
    },
    {
      "id": 117925625,
      "login": "scoped",
      "description": null,
      "inherited": false
    }
  ],
  "smart_proxies": [
    {
      "name": "BMC proxy",
      "id": 821748566,
      "url": "http://else.where:45673",
      "inherited": false
    },
    {
      "name": "DHCP Proxy",
      "id": 980190962,
      "url": "https://somewhere.net:8443",
      "inherited": false
    },
    {
      "name": "DNS Proxy",
      "id": 113629430,
      "url": "http://else.where:45671",
      "inherited": false
    },
    {
      "name": "Puppetmaster Proxy",
      "id": 182953976,
      "url": "http://else.where:4567",
      "inherited": false
    },
    {
      "name": "Realm Proxy",
      "id": 982965213,
      "url": "http://else.where:1337",
      "inherited": false
    },
    {
      "name": "TFTP Proxy",
      "id": 298486374,
      "url": "http://somewhere.else",
      "inherited": false
    }
  ],
  "subnets": [
    {
      "id": 980190962,
      "name": "one",
      "description": null,
      "network_address": "2.3.4.0/24",
      "inherited": false
    },
    {
      "id": 1018350795,
      "name": "five",
      "description": null,
      "network_address": "10.0.0.0/24",
      "inherited": false
    }
  ],
  "compute_resources": [
    {
      "id": 980190962,
      "name": "bigcompute",
      "provider": "Libvirt",
      "provider_friendly_name": "Libvirt",
      "inherited": false
    },
    {
      "id": 367690737,
      "name": "mycompute",
      "provider": "Libvirt",
      "provider_friendly_name": "Libvirt",
      "inherited": false
    }
  ],
  "media": [
    {
      "id": 980190962,
      "name": "CentOS 5.4",
      "inherited": false
    }
  ],
  "ptables": [],
  "provisioning_templates": [
    {
      "id": 269958254,
      "name": "MyString2",
      "template_kind_id": 983253650,
      "template_kind_name": "provision",
      "inherited": false
    }
  ],
  "domains": [
    {
      "id": 22495316,
      "name": "mydomain.net",
      "inherited": false
    },
    {
      "id": 589326610,
      "name": "yourdomain.net",
      "inherited": false
    },
    {
      "id": 759776763,
      "name": "unused.net",
      "inherited": false
    },
    {
      "id": 229305443,
      "name": "useless.net",
      "inherited": false
    }
  ],
  "realms": [
    {
      "id": 664044182,
      "name": "myrealm.net",
      "realm_proxy_id": 982965213,
      "realm_type": "FreeIPA",
      "inherited": false
    }
  ],
  "hostgroups": [
    {
      "id": 636252244,
      "name": "Common",
      "title": "Common",
      "description": null,
      "inherited": false
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ],
  "hosts_count": 0,
  "parameters": [
    {
      "priority": null,
      "created_at": "2022-09-06 15:15:23 UTC",
      "updated_at": "2022-09-06 15:15:23 UTC",
      "id": 513706444,
      "name": "loc_param",
      "parameter_type": "string",
      "value": "abc"
    }
  ],
  "deprecations": {
    "environments": "Environments got deprecated from this endpoint."
  }
}

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

location
required

Validations:

  • Must be a Hash

location[name]
optional

Validations:

  • Must be a String

location[description]
optional , nil allowed

Validations:

  • Must be a String

location[user_ids]
optional , nil allowed

User IDs

Validations:

  • Must be an array of any type

location[smart_proxy_ids]
optional , nil allowed

Smart proxy IDs

Validations:

  • Must be an array of any type

location[compute_resource_ids]
optional , nil allowed

Compute resource IDs

Validations:

  • Must be an array of any type

location[medium_ids]
optional , nil allowed

Medium IDs

Validations:

  • Must be an array of any type

location[ptable_ids]
optional , nil allowed

Partition template IDs

Validations:

  • Must be an array of any type

location[provisioning_template_ids]
optional , nil allowed

Provisioning template IDs

Validations:

  • Must be an array of any type

location[domain_ids]
optional , nil allowed

Domain IDs

Validations:

  • Must be an array of any type

location[realm_ids]
optional , nil allowed

Realm IDs

Validations:

  • Must be an array of any type

location[hostgroup_ids]
optional , nil allowed

Host group IDs

Validations:

  • Must be an array of any type

location[environment_ids]
optional , nil allowed

Environment IDs

Validations:

  • Must be an array of any type

location[subnet_ids]
optional , nil allowed

Subnet IDs

Validations:

  • Must be an array of any type

location[parent_id]
optional , nil allowed

Parent ID

Validations:

  • Must be a number.

location[ignore_types]
optional , nil allowed

List of resources types that will be automatically associated

Validations:

  • Must be an array of any type

location[organization_ids]
optional , nil allowed

Associated organization IDs

Validations:

  • Must be an array of any type

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.


DELETE /api/locations/:id
Delete a location

Examples

DELETE /api/locations/373111740-Location%202
{
  "location": {}
}
200
{
  "id": 373111740,
  "name": "Location 2",
  "created_at": "2022-09-06T15:15:23.363Z",
  "updated_at": "2022-09-06T15:15:23.363Z",
  "ignore_types": [],
  "ancestry": null,
  "title": "Location 2",
  "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.