### Example Request for Provisioning Templates per Operating System Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/provisioning_templates/index.html An example of a GET request to list provisioning templates for a specific operating system and its successful JSON response. ```APIDOC ## GET /api/operatingsystems/centos%205.3/provisioning_templates ### Request Example ``` GET /api/operatingsystems/centos%205.3/provisioning_templates ``` ### Response Example (200 OK) ```json { "total": 13, "subtotal": 13, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 1007981701, "name": "centos5_3_pxelinux", "template_kind_id": 452984334, "template_kind_name": "PXELinux" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 698706415, "name": "iPXE Dummy Menu", "template_kind_id": 698706415, "template_kind_name": "iPXE" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 718456980, "name": "Locked Template", "template_kind_id": 983253650, "template_kind_name": "provision" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 104314179, "name": "MyFinish", "template_kind_id": 550103832, "template_kind_name": "finish" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 981457253, "name": "MyScript", "template_kind_id": 478250810, "template_kind_name": "script" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 943779058, "name": "MyString", "template_kind_id": 698706415, "template_kind_name": "iPXE" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 269958254, "name": "MyString2", "template_kind_id": 983253650, "template_kind_name": "provision" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 684651467, "name": "PXE Default Menu", "template_kind_id": 710512633, "template_kind_name": null }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 554905648, "name": "PXEGrub2 global default", "template_kind_id": 701398793, "template_kind_name": "PXEGrub2" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 131565194, "name": "PXEGrub Dummy Menu", "template_kind_id": 131565194, "template_kind_name": "PXEGrub" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 824224502, "name": "PXEGrub global default", "template_kind_id": 131565194, "template_kind_name": "PXEGrub" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 821548108, "name": "PXELinux default local boot", "template_kind_id": 452984334, "template_kind_name": "PXELinux" }, { "snippet": false, "audit_comment": null, "created_at": "2018-07-24 13:18:18 UTC", "updated_at": "2018-07-24 13:18:18 UTC", "id": 352050261, "name": "PXELinux global default", "template_kind_id": 452984334, "template_kind_name": "PXELinux" } ] } ``` ``` -------------------------------- ### Create Host Interface Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/interfaces/create.html This example demonstrates how to create a new network interface for a host. It includes the request body with interface details and an example of a server response indicating an error. ```bash POST /api/hosts/host2200/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": "UNKNOWN", "ip6": "2001:db8::1" } } 422 { "error": { "message": "ERF13-6594 [InterfaceTypeMapper::UnknownTypeExeption]: Unknown interface type, must be one of [interface, bmc, bond, bridge]" } } ``` -------------------------------- ### List Available Resource Types Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/permissions/resource_types.html This example shows how to make a GET request to the resource types endpoint. The response includes a list of all available resource types, such as 'Architecture', 'User', and 'Host'. ```bash GET /api/permissions/resource_types ``` ```json { "total": 36, "subtotal": 36, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "name": "Architecture" }, { "name": "Audit" }, { "name": "AuthSource" }, { "name": "Bookmark" }, { "name": "CommonParameter" }, { "name": "ComputeProfile" }, { "name": "ComputeResource" }, { "name": "ConfigReport" }, { "name": "Domain" }, { "name": "Environment" }, { "name": "FactValue" }, { "name": "Host" }, { "name": "HostClass" }, { "name": "Hostgroup" }, { "name": "Image" }, { "name": "Location" }, { "name": "Medium" }, { "name": "Model" }, { "name": "MyPlugin" }, { "name": "Operatingsystem" }, { "name": "Organization" }, { "name": "Parameter" }, { "name": "ProvisioningTemplate" }, { "name": "Ptable" }, { "name": "Puppetclass" }, { "name": "PuppetclassLookupKey" }, { "name": "Realm" }, { "name": "Report" }, { "name": "Role" }, { "name": "SmartProxy" }, { "name": "Subnet" }, { "name": "Test::Resource" }, { "name": "Trend" }, { "name": "User" }, { "name": "Usergroup" }, { "name": "VariableLookupKey" } ] } ``` -------------------------------- ### Get Provisioning Template Content Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hosts/template.html Example of requesting a provisioning template for a host that does not exist. This will result in a 404 error. ```bash GET /api/hosts/host303.example90.com/template/provitamin 404 { "message": "No template with kind provitamin for host303.example90.com" } ``` -------------------------------- ### List All Installation Media Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/media.html Retrieves a list of all available installation media. Supports filtering, sorting, and pagination. ```bash GET /api/media ``` -------------------------------- ### List All Installation Media Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/media/index.html Retrieves a list of all available installation media. Supports filtering and pagination. ```bash GET /api/media 200 { "total": 5, "subtotal": 5, "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": "2018-07-24 12:43:14 UTC", "updated_at": "2018-07-24 12:43:14 UTC", "id": 980190962, "name": "CentOS 5.4" }, { "path": "http://download.opensuse.org/distribution/$version/repo/oss", "os_family": null, "created_at": "2018-07-24 12:43:14 UTC", "updated_at": "2018-07-24 12:43:14 UTC", "id": 750842046, "name": "OpenSUSE" }, { "path": "http://brsla01/vol/solgi_5.10/sol$minor_$release_$arch", "os_family": null, "created_at": "2018-07-24 12:43:14 UTC", "updated_at": "2018-07-24 12:43:14 UTC", "id": 442321401, "name": "Solaris 10" }, { "path": "http://sg.archive.ubuntu.com", "os_family": null, "created_at": "2018-07-24 12:43:14 UTC", "updated_at": "2018-07-24 12:43:14 UTC", "id": 1011586618, "name": "Ubuntu Mirror" }, { "path": "http://nothing.intersting.com", "os_family": null, "created_at": "2018-07-24 12:43:14 UTC", "updated_at": "2018-07-24 12:43:14 UTC", "id": 338446587, "name": "unused" } ] } ``` -------------------------------- ### Create Config Report Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/config_reports/create.html Demonstrates a successful POST request to create a configuration report. Includes an example of a 403 Forbidden response due to insufficient permissions. ```bash POST /api/config_reports { "config_report": {} } 403 { "error": { "message": "Access denied", "details": "Missing one of the required permissions: upload_config_reports" } } ``` -------------------------------- ### List all installation media Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/media/index.html Retrieves a list of all available installation media. Supports filtering, sorting, and pagination. ```APIDOC ## GET /api/media ### Description Lists all installation media. ### Method GET ### Endpoint /api/media ### Parameters #### Query Parameters - **search** (string) - Optional - Filter results. - **order** (string) - Optional - Sort field and order, e.g., ‘id DESC’. - **page** (string) - Optional - Paginate results. - **per_page** (string) - Optional - Number of entries per request. ### Response #### Success Response (200) - **total** (integer) - The total number of media items. - **subtotal** (integer) - The number of media items in the current response. - **page** (integer) - The current page number. - **per_page** (integer) - The number of items per page. - **search** (string) - The search query used. - **sort** (object) - Sorting parameters. - **by** (string) - The field to sort by. - **order** (string) - The sort order (ASC/DESC). - **results** (array) - A list of media items. - **path** (string) - The path to the media. - **os_family** (string) - The operating system family. - **created_at** (string) - The timestamp when the media was created. - **updated_at** (string) - The timestamp when the media was last updated. - **id** (integer) - The unique identifier for the media. - **name** (string) - The name of the media. ### Request Example ``` GET /api/media ``` ### Response Example ```json { "total": 5, "subtotal": 5, "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": "2018-07-24 12:43:14 UTC", "updated_at": "2018-07-24 12:43:14 UTC", "id": 980190962, "name": "CentOS 5.4" } ] } ``` ``` -------------------------------- ### Show Organization Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/organizations/show.html Demonstrates how to request details for a specific organization using its ID. Includes an example of a 404 Not Found response. ```bash GET /api/organizations/447626439-org1 404 { "error": { "message": "Resource organization not found by id '447626439-org1'" } } ``` -------------------------------- ### Example Hostgroup Configuration Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hostgroups.html This example shows a hostgroup with inherited settings, including puppet proxy details. ```json { "updated_at": "2018-07-24 13:08:00 UTC", "id": 928644285, "name": "inherited", "title": "Parent/inherited", "description": null, "puppet_proxy_id": null, "puppet_proxy_name": "Puppetmaster Proxy", "puppet_ca_proxy_id": null, "puppet_ca_proxy_name": "Puppetmaster Proxy", "puppet_proxy": { "name": "Puppetmaster Proxy", "id": 182953976, "url": "http://else.where:4567" }, "puppet_ca_proxy": { "name": "Puppetmaster Proxy", "id": 182953976, "url": "http://else.where:4567" } } ``` -------------------------------- ### Create Role Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/roles/create.html Demonstrates how to create a new role by sending a PUT request with the role name. Includes an example of the expected error response for insufficient permissions. ```http PUT /api/roles { "role": { "name": "newrole" } } 403 { "error": { "message": "Access denied", "details": "Missing one of the required permissions: create_roles" } } ``` -------------------------------- ### Get All Settings Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/settings/index.html This example shows how to retrieve all available settings from the Foreman API. The response includes details such as the setting's value, description, category, and default value. ```bash GET /api/settings 200 { "total": 76, "subtotal": 76, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "value": "http://foreman.some.host.fqdn", "description": "The URL Foreman should point to in emails etc", "category": "Setting::General", "settings_type": null, "default": "http://foreman.some.host.fqdn", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 182539440, "name": "foreman_url", "full_name": null, "category_name": "General" }, { "value": null, "description": "Default root password on provisioned hosts", "category": "Setting::Provisioning", "settings_type": null, "default": null, "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 1038509113, "name": "root_pass", "full_name": null, "category_name": "Provisioning" }, { "value": true, "description": "Enable safe mode config templates rendinging(recommended)", "category": "Setting::Provisioning", "settings_type": null, "default": true, "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 595784092, "name": "safemode_render", "full_name": null, "category_name": "Provisioning" }, { "value": "/var/lib/puppet/ssl/certs/some.host.fqdn", "description": "SSL Certificate path that foreman would use to communicate with its proxies", "category": "Setting::Provisioning", "settings_type": null, "default": "/var/lib/puppet/ssl/certs/some.host.fqdn", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 344310031, "name": "ssl_certificate", "full_name": null, "category_name": "Provisioning" }, { "value": "/var/lib/puppet/ssl/certs/ca.pem", "description": "SSL CA file that foreman would use to communicate with its proxies", "category": "Setting::Provisioning", "settings_type": null, "default": "/var/lib/puppet/ssl/certs/ca.pem", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 227315895, "name": "ssl_ca_file", "full_name": null, "category_name": "Provisioning" }, { "value": "/var/lib/puppet/ssl/private_keys/super.some.host.fqdn.pem", "description": "SSL Private Key file that foreman would use to communicate with its proxies", "category": "Setting::Provisioning", "settings_type": null, "default": "/var/lib/puppet/ssl/private_keys/super.some.host.fqdn.pem", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 982229024, "name": "ssl_priv_key", "full_name": null, "category_name": "Provisioning" }, { "value": 30, "description": "Setting::Puppet interval in minutes", "category": "Setting::Puppet", "settings_type": "integer", "default": 30, "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 708099507, "name": "puppet_interval", "full_name": null, "category_name": "Puppet" }, { "value": "production", "description": "The Setting::Puppet environment foreman would default to in case it can't auto detect it", "category": "Setting::Puppet", "settings_type": null, "default": "production", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 489917738, "name": "default_puppet_environment", "full_name": null, "category_name": "Puppet" }, { "value": "/etc/puppet/modules", "description": "The Setting::Puppet default module path in case that Foreman can't auto detect it", "category": "Setting::Puppet", "settings_type": null, "default": "/etc/puppet/modules", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 433443793, "name": "modulepath", "full_name": null, "category_name": "Puppet" }, { "value": "puppet", "description": "Default Setting::Puppet Server hostname", "category": "Setting::Puppet", "settings_type": null, "default": "puppet", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 937145060, "name": "puppet_server", "full_name": null, "category_name": "Puppet" }, { "value": false, "description": "Enable Email Alerts per each failed puppet report", "category": "Setting::Puppet", "settings_type": null, "default": false, "created_at": "2018-07-24 12:43:52 UTC" } ] } ``` -------------------------------- ### Setting Response Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/settings.html Example of a successful response when retrieving a setting. It includes the current value, description, category, and other metadata. ```json { "value": "root@some.host.fqdn", "description": "The Default administrator email address", "category": "Setting::General", "settings_type": "string", "default": "root@some.host.fqdn", "created_at": "2018-07-24 12:43:52 UTC", "updated_at": "2018-07-24 12:43:52 UTC", "id": 333972760, "name": "administrator", "full_name": null, "category_name": "General" } ``` -------------------------------- ### Get Last Config Report for a Host Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/config_reports/last.html Example of a GET request to retrieve the last configuration report for a host. Includes a 404 response example when the report is not found. ```bash GET /api/hosts/host722/config_reports/last 404 { "error": { "message": "Resource config_report not found by id ''" } } ``` -------------------------------- ### Create Operating System Request Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/operatingsystems/create.html Use this example to create a new operating system. Ensure all required fields are provided. The response will indicate success or failure with details. ```bash POST /api/operatingsystems { "operatingsystem": { "name": "awsome_os", "minor": "2" } } 422 { "error": { "id": null, "errors": { "major": [ "is not a number", "Operating System version is required" ] }, "full_messages": [ "Major is not a number", "Major Operating System version is required" ] } } ``` -------------------------------- ### Get PTable Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/ptables.html This example demonstrates how to retrieve a specific PTable by its ID using the Foreman API v2. Ensure you have the correct PTable ID. ```bash curl -s -H "Content-Type: application/json" -H "Accept: application/json" https://foreman.example.com/api/v2/ptables/1007981705 ``` -------------------------------- ### Show Report by ID (Not Found) Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/reports/show.html Example of a GET request for a report that does not exist, resulting in a 404 error response. ```bash GET /api/reports/2 404 { "error": { "message": "Resource report not found by id '2'" } } ``` -------------------------------- ### Show Architecture Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/architectures/show.html Demonstrates how to retrieve a specific architecture by its ID. The response includes details like creation date, name, ID, and associated operating systems and images. ```bash GET /api/architectures/501905019-x86_64 200 { "created_at": "2018-07-24 13:03:54 UTC", "updated_at": "2018-07-24 13:03:54 UTC", "name": "x86_64", "id": 501905019, "operatingsystems": [ { "id": 309172073, "name": "centos", "title": "centos 5.3" }, { "id": 750842046, "name": "OpenSuse", "title": "OpenSuSE 12.3" }, { "id": 1073012828, "name": "Redhat", "title": "RHEL 6.1" }, { "id": 331303656, "name": "Ubuntu", "title": "Ubuntu 10.10" }, { "id": 272342666, "name": "Ubuntu", "title": "Ubuntu 12.10" } ], "images": [ { "id": 980190962, "name": "centos-1" }, { "id": 298486374, "name": "centos-2" } ] } ``` -------------------------------- ### Get User Table Preferences (Forbidden) Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/table_preferences/index.html Example of attempting to access another user's table preferences, resulting in a 403 Forbidden error. ```http GET /api/users/980190963/table_preferences 403 { "error": { "message": "Access denied", "details": "You are trying access the preferences of a different user" } } ``` -------------------------------- ### List installed plugins Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/home/index.html Retrieves a list of all installed plugins in the Foreman instance. ```APIDOC ## GET /api/plugins ### Description Lists all installed plugins. ### Method GET ### Endpoint /api/plugins ``` -------------------------------- ### List Host Configuration Reports Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/config_reports/index.html This example shows how to retrieve a list of configuration reports for a specific host. The response includes pagination details and an empty results array if no reports are found. ```bash GET /api/hosts/host719/config_reports 200 { "total": 0, "subtotal": 0, "page": 1, "per_page": 20, "search": " host = host719", "sort": { "by": null, "order": null }, "results": [] } ``` -------------------------------- ### Example Request for Subnets by Location Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/subnets/index.html An example of how to request subnets filtered by a specific location. ```APIDOC ## GET /api/locations/447626440/subnets ### Response Example ```json { "total": 1, "subtotal": 1, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "network": "102.187.85.0", "network_type": "IPv4", "cidr": 24, "mask": "255.255.255.0", "priority": null, "vlanid": null, "mtu": 1500, "gateway": null, "dns_primary": null, "dns_secondary": null, "from": null, "to": null, "created_at": "2018-07-24 13:13:47 UTC", "updated_at": "2018-07-24 13:13:47 UTC", "ipam": "None", "boot_mode": "DHCP", "id": 1018350802, "name": "subnet551", "description": null, "network_address": "102.187.85.0/24", "dhcp_id": null, "dhcp_name": null, "tftp_id": null, "tftp_name": null, "dns_id": null, "template_id": null, "template_name": null, "dhcp": null, "tftp": null, "dns": null, "template": null } ] } ``` ``` -------------------------------- ### Example Request and Response Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/puppetclasses/index.html An example of how to request Puppet classes for a host and the structure of a successful response. ```APIDOC ### Request Example ``` GET /api/hosts/host1917/puppetclasses ``` ### Response Example (200 OK) ```json { "total": 1, "subtotal": 1, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": { "class352": [ { "id": 1018350799, "name": "class352", "created_at": "2018-07-24T13:11:15.703Z", "updated_at": "2018-07-24T13:11:15.703Z" } ] } } ``` ``` -------------------------------- ### List Installed Plugins Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/plugins.html Retrieves a list of all installed plugins. This endpoint can be filtered by location and organization. ```APIDOC ## GET /api/plugins ### Description List installed plugins. ### Method GET ### Endpoint /api/plugins ### Parameters #### Query Parameters - **location_id** (integer) - Optional - Scope by locations - **organization_id** (integer) - Optional - Scope by organizations ### Response #### Success Response (200) - **total** (integer) - The total number of results. - **subtotal** (integer) - The subtotal of results for the current page. - **page** (integer) - The current page number. - **per_page** (integer) - The number of results per page. - **search** (string) - The search query used, if any. - **sort** (object) - An object containing sorting parameters. - **by** (string) - The field by which results are sorted. - **order** (string) - The order of sorting (e.g., 'asc', 'desc'). - **results** (array) - An array of plugin objects. - **id** (string) - The unique identifier of the plugin. - **name** (string) - The name of the plugin. - **author** (string) - The author of the plugin. - **description** (string) - A description of the plugin. - **url** (string) - The URL associated with the plugin. - **version** (string) - The version of the plugin. ### Request Example ``` GET /api/plugins ``` ### Response Example ```json { "total": 1, "subtotal": 1, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "id": "skip_test", "name": null, "author": null, "description": null, "url": null, "version": null } ] } ``` ``` -------------------------------- ### Boot Host Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hosts/boot.html Initiates a boot action for a specified host from a given device. ```APIDOC ## PUT /api/hosts/:id/boot ### Description Boot host from specified device. ### Method PUT ### Endpoint /api/hosts/:id/boot ### Parameters #### Path Parameters - **id** (string) - Required - **Validations:** Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space. #### Query Parameters - **location_id** (integer) - Optional - Scope by locations. - **organization_id** (integer) - Optional - Scope by organizations. #### Request Body - **device** (string) - Required - Boot device, valid devices are disk, cdrom, pxe, bios. - **host** (object) - Required - An empty object is expected here. ### Request Example ```json { "device": "bios", "host": {} } ``` ### Response #### Success Response (200) - **boot** (string) - A JSON string containing the boot action and result. #### Response Example ```json { "boot": "{\"action\":\"bios\",\"result\":true}" } ``` ``` -------------------------------- ### List Hostgroups Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hostgroups/index.html This example demonstrates how to retrieve a list of hostgroups. It shows the structure of a hostgroup object, including details like name, ID, and proxy configurations. ```json [ { "updated_at": "2018-07-24 13:08:00 UTC", "id": 928644285, "name": "inherited", "title": "Parent/inherited", "description": null, "puppet_proxy_id": null, "puppet_proxy_name": "Puppetmaster Proxy", "puppet_ca_proxy_id": null, "puppet_ca_proxy_name": "Puppetmaster Proxy", "puppet_proxy": { "name": "Puppetmaster Proxy", "id": 182953976, "url": "http://else.where:4567" }, "puppet_ca_proxy": { "name": "Puppetmaster Proxy", "id": 182953976, "url": "http://else.where:4567" } }, { "subnet_id": null, "subnet_name": null, "operatingsystem_id": null, "operatingsystem_name": null, "domain_id": null, "domain_name": null, "environment_id": null, "environment_name": null, "compute_profile_id": null, "compute_profile_name": null, "ancestry": null, "parent_id": null, "parent_name": null, "ptable_id": null, "ptable_name": null, "medium_id": null, "medium_name": null, "pxe_loader": null, "subnet6_id": null, "subnet6_name": null, "architecture_id": null, "architecture_name": null, "realm_id": null, "realm_name": null, "created_at": "2018-07-24 13:08:00 UTC", "updated_at": "2018-07-24 13:08:00 UTC", "id": 866317115, "name": "Unusual", "title": "Unusual", "description": null, "puppet_proxy_id": 182953976, "puppet_proxy_name": "Puppetmaster Proxy", "puppet_ca_proxy_id": null, "puppet_ca_proxy_name": null, "puppet_proxy": { "name": "Puppetmaster Proxy", "id": 182953976, "url": "http://else.where:4567" }, "puppet_ca_proxy": null } ] ``` -------------------------------- ### Rebuild Host Configuration Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hosts/rebuild_config.html Demonstrates how to rebuild the configuration for a specific host using a POST request. Includes the request body and the expected success response. ```http POST /api/hosts/host239/rebuild_config { "host": {} } 200 { "message": "Configuration successfully rebuilt." } ``` -------------------------------- ### Boot Host from Device Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hosts.html Use this endpoint to initiate a host boot sequence from a specified device. Requires the host ID and the desired boot device (e.g., 'bios', 'disk', 'cdrom', 'pxe'). ```http PUT /api/hosts/host1867.example806.com/boot { "device": "bios", "host": {} } 200 { "boot": "{\"action\":\"bios\",\"result\":true}" } ``` -------------------------------- ### Delete Location Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/locations/destroy.html Use this example to delete a specific location by its ID. Ensure the ID is correctly formatted. ```bash DELETE /api/locations/373111740-Location%202 { "location": {} } 200 { "id": 373111740, "name": "Location 2", "created_at": "2018-07-24T13:14:01.556Z", "updated_at": "2018-07-24T13:14:01.556Z", "ignore_types": [], "ancestry": null, "title": "Location 2", "description": null } ``` -------------------------------- ### Create Partition Table with Existing Partition Table Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/ptables/create.html Example of creating a partition table that references an existing partition table. This is useful for applying a predefined layout to new hosts. ```json { "label": "MyPartitionTable", "os_family": "RedHat", "partition_table_id": 1007981705 } ``` -------------------------------- ### List Installed Plugins Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/plugins/index.html Retrieves a list of all installed plugins on the Foreman instance. Supports filtering by location and organization. ```APIDOC ## GET /api/plugins ### Description List installed plugins ### Method GET ### Endpoint /api/plugins ### Parameters #### Query Parameters - **location_id** (Integer) - Optional - Scope by locations - **organization_id** (Integer) - Optional - Scope by organizations ### Response #### Success Response (200) - **total** (Integer) - Total number of results - **subtotal** (Integer) - Subtotal of results for the current page - **page** (Integer) - Current page number - **per_page** (Integer) - Number of results per page - **search** (String) - Search query used (null if not applicable) - **sort** (Object) - Sorting parameters - **by** (String) - Field to sort by (null if not applicable) - **order** (String) - Sort order (null if not applicable) - **results** (Array) - List of plugin objects - **id** (String) - Unique identifier for the plugin - **name** (String) - Name of the plugin (null if not available) - **author** (String) - Author of the plugin (null if not available) - **description** (String) - Description of the plugin (null if not available) - **url** (String) - URL for the plugin (null if not available) - **version** (String) - Version of the plugin (null if not available) ### Request Example ``` GET /api/plugins ``` ### Response Example ```json { "total": 1, "subtotal": 1, "page": 1, "per_page": 20, "search": null, "sort": { "by": null, "order": null }, "results": [ { "id": "skip_test", "name": null, "author": null, "description": null, "url": null, "version": null } ] } ``` ``` -------------------------------- ### Boot Host Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/hosts.html Initiates a boot sequence for a specified host from a given device. ```APIDOC ## PUT /api/hosts/:id/boot ### Description Boot host from specified device ### Method PUT ### Endpoint /api/hosts/:id/boot ### Parameters #### Path Parameters - **id** (string) - Required - Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space. #### Query Parameters - **location_id** (integer) - Optional - Scope by locations - **organization_id** (integer) - Optional - Scope by organizations #### Request Body - **device** (string) - Required - boot device, valid devices are disk, cdrom, pxe, bios - **host** (object) - Required - Placeholder for host details ### Request Example ```json { "device": "bios", "host": {} } ``` ### Response #### Success Response (200) - **boot** (string) - Contains action and result of the boot operation ``` -------------------------------- ### User Attributes Example Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/users.html This snippet shows an example of user attributes, specifically the 'effective_admin' flag. This is typically used to determine a user's administrative privileges. ```json { "effective_admin": false } ``` -------------------------------- ### Create a Partition Table Source: https://apidocs.theforeman.org/foreman/1.19/apidoc/v2/ptables.html Endpoint for creating a new partition table. No example provided in the source.