Differences between apis

What is the difference between the api hosts/:id/ and hosts/:id/enc/?

hosts/:id provides access all the various host attributes.
hosts/:id/enc provides the same output that is given to the External Node Classifier for config managment platforms such as puppet.

1 Like

If api hosts/:id provides all attributes, should not it also have more informations like foreman_users that is provided only by hosts/:id/enc/?

Not all the information in the ENC output is attributes of the host.
For example, some of it is global parameters or puppet class parameters.
Others, such as foreman_users, provides additional information that may be useful in the context of configuration management, or are needed for use by some plugins.
Specifically, foreman_users provides additional details on the owners of the host that aren’t included in the regular api output for the host, since they aren’t actually attributes of the host - for example, all the owners’ ssh keys and full names.


We can then conclude that in the context of configuration management such as Puppet and Ansible, hosts/:id and hosts/:id/enc/ contain complementary information and both retrieve important data in that context.

Tks, @tbrisker!

1 Like