Get hypervisor of host via API

I see the hypervisor in the webfronted but I cannot get it via API
Expected outcome:
See Hypervisor via API
Foreman and Proxy versions:
Foreman and Proxy plugin versions:

Other relevant data:

Is there a way to get the hypervisor via API.

Thanks in advance and best regards

Define “hypervisor”. What exactly do you want to do? What is “get the hypervisor”? Have you seen our API documentation?

Sorry for being quite inaccurate. Yes I read the API documentation.
So we are running Foreman 1.16 connected to vSphere to provision virtual machines. In order to make custom requests I need to know the hypervisor.

As you can see the webfrontend shows me the required information but the API does not provide this information as far as I can see. Is there another way to get the hypervisor via API?

I can also provide the JSON I get from the API, but this would take some time to clear some information.

Best regards and thanks

I use the following to call the Foreman API:
curl --netrc -H "Content-Type: application/json"

  "ip": "10.xx.xx.x",
  "ip6": "",
  "environment_id": 2,
  "environment_name": "production",
  "last_report": null,
  "mac": "00:xx:xx:xx:xx:xx",
  "realm_id": null,
  "realm_name": null,
  "sp_mac": null,
  "sp_ip": null,
  "sp_name": null,
  "domain_id": 1,
  "domain_name": "",
  "architecture_id": 1,
  "architecture_name": "x86_64",
  "operatingsystem_id": 8,
  "operatingsystem_name": "Debian 9.3",
  "subnet_id": 28,
  "subnet_name": "example-net",
  "subnet6_id": null,
  "subnet6_name": null,
  "sp_subnet_id": null,
  "ptable_id": 93,
  "ptable_name": "xx BTRFS",
  "medium_id": 9,
  "medium_name": "Debian",
  "pxe_loader": "None",
  "build": true,
  "comment": "",
  "disk": "",
  "installed_at": null,
  "model_id": null,
  "hostgroup_id": null,
  "owner_id": 1,
  "owner_type": "Usergroup",
  "enabled": true,
  "managed": true,
  "use_image": null,
  "image_file": "",
  "uuid": "5026dac6-07b9-2bd9-8e96-d3065803d7a3",
  "compute_resource_id": 1,
  "compute_resource_name": "VMware",
  "compute_profile_id": null,
  "compute_profile_name": null,
  "capabilities": [
  "provision_method": "build",
  "certname": "",
  "image_id": null,
  "image_name": null,
  "created_at": "2018-02-20 15:36:18 UTC",
  "updated_at": "2018-02-20 15:36:18 UTC",
  "last_compile": null,
  "global_status": 0,
  "global_status_label": "Warning",
  "location_id": 1,
  "location_name": "xxx",
  "puppet_status": 0,
  "model_name": null,
  "configuration_status": 0,
  "configuration_status_label": "No reports",
  "build_status": 1,
  "build_status_label": "Pending installation",
  "name": "",
  "id": 2208,
  "puppet_proxy_id": 36,
  "puppet_proxy_name": "",
  "puppet_ca_proxy_id": 38,
  "puppet_ca_proxy_name": "",
  "puppet_proxy": {
    "name": "",
    "id": 36,
    "url": ""
  "puppet_ca_proxy": {
    "name": "",
    "id": 38,
    "url": ""
  "token": "0017109f-9d45-4180-aa24-7cb0a586adfe",
  "hostgroup_name": null,
  "hostgroup_title": null,
  "parameters": [],
  "all_parameters": [],
  "interfaces": [
      "id": 3524,
      "name": "",
      "ip": "10.xx.xx.x",
      "ip6": "",
      "mac": "00:xx:xx:xx:xx:xx",
      "fqdn": "",
      "identifier": "",
      "primary": true,
      "provision": true,
      "type": "interface"
  "puppetclasses": [],
  "config_groups": [],
  "all_puppetclasses": [],
  "permissions": {
    "view_hosts": true,
    "create_hosts": true,
    "edit_hosts": true,
    "destroy_hosts": true,
    "build_hosts": true,
    "power_hosts": true,
    "console_hosts": true,
    "ipmi_boot_hosts": true,
    "puppetrun_hosts": true,
    "view_discovered_hosts": true,
    "submit_discovered_hosts": true,
    "auto_provision_discovered_hosts": true,
    "provision_discovered_hosts": true,
    "edit_discovered_hosts": true,
    "destroy_discovered_hosts": true,
    "view_monitoring_results": true,
    "manage_host_downtimes": true

Hope this helps. Thanks alot.

Hi, compute_resource_name should give you the name of the hypervisor - at least it does with libvirt - perhaps if this doesn’t work you could use the compute_resource_id returned from the API call to hosts in another API call to GET /api/compute_resources/:id ?

Hi there. Unfortunately “compute_resource_name” does not contain the name of the hypervisor. Instead it contains the name of the vSphere cluster. And even if I try to query the /api_compute_resources/id endpoint it does not give me the hypervisors.

  "description": "",
  "url": "vSphere-URL-here",
  "created_at": "2018-02-08 08:26:00 UTC",
  "updated_at": "2018-02-08 08:26:00 UTC",
  "id": 1,
  "name": "VMware Test",
  "provider": "Vmware",
  "provider_friendly_name": "VMware",
  "user": "foreman-user",
  "datacenter": "xxx",
  "server": "vsphere-domain-here",
  "set_console_password": true,
  "caching_enabled": true,
  "images": [],
  "compute_attributes": [],
  "locations": []

Hello, compute_resource_name really contains provider name rather than resource name. It’s a bug perhaps.

Hi @lzap,

should I report this in Foreman’s bugtracker then?


I wouldn’t say this is a bug. A compute resource is a vcenter which can contain many clusters each with multiple hypervisor.

The reason this isn’t included is that the foreman doesn’t store this in its database and thus requires an API call to vcenter.

Given it’s on the host detail page it could make sense to include it in the host api detail page too, but on the listing would probably be too expensive. AFAIK we have no (generic) way to include additional fields.