API » History » Revision 5
Revision 4 (Ohad Levy, 11/04/2010 10:41 AM) → Revision 5/45 (Ohad Levy, 11/04/2010 10:45 AM)
h1. API
Foreman provides a "REST":http://en.wikipedia.org/wiki/Representational_State_Transfer API, communicating via JSON.
Please refer to this document for latest information about API structure.
Examples below are either via curl or ruby rest_client
most pages can be browsed via adding the format option to the url (at least for get requests), i.e.
<pre>
http://foreman/environemnts?format=json
</pre>
Or using HTTP Headers
<pre>
curl -H "Content-Type:application/json" -H "Accept:application/json" http://foreman/hosts
</pre>
Output is JSON formatted, in the last example expect a similar output:
<pre>
[{"host":{"name":"pm.local.net"}},{"host":{"name":"pm.local.net"}}....]
</pre>
h2. List of API's
|_.Path|_.REST Type|_.Description|
|/architectures|GET|List of valid OS Architectures(name and ID)|
|/architectures/x86_64|GET|Description of the x86_64 Architecture (name and ID)|
|/dashboard|GET|Summary statistcs (total hosts, active hosts, hosts in error etc)|
|/domains|GET|List of known domains (name and ID)|
|/domains/my_domain|GET|Description of "my_domain" (name and ID)|
|/environments|GET|List of known environments (name and ID)|
|/environments/production|GET|Description of the "production" (name and ID and associated host list)|
|/fact_values|GET|List of known Facts (value, name and host)|
|/hostgroups|GET|List of known hostgroups (name and ID)|
|/hostgroups/common|GET|Description of "common" (name and ID)|
|/hosts|GET|List of known hosts (only name)|
|/hosts/errors|GET|List of hosts in error state(only name)|
|/hosts/active|GET|List of active hosts(only name)|
|/hosts/out_of_sync|GET|List of out of sync hosts(only name)|
|/hosts/disabled|GET|List of disabled hosts(only name)|
|/hosts|POST|creates a new host, 201 return sucesful creation, otherwise the errors will be returned|
|/hosts/fqdn|GET|Host Attributes (name, usergroup, last_report, os properties...)|
|/hosts/fqdn|DELETE|Removes the host "fqdn"|
|/hosts/fqdn/setBuild|GET| Enable Host for (re-)build |
|/hosts/fqdn/facts|GET| Returns host facts|
|/medias|GET|List of known mediums (name and ID)|
|/medias/1|GET|Description of media which ID is 1 (name and ID and path/url)|
|/operatingsystems|GET|List of known operating systems (Release name, ID and allowed mediums, architectures and partition tables)|
|/operatingsystems/1|GET| Description of operating systems which its ID is 1 (Release name, ID and allowed mediums, architectures and partition tables)|
|/ptables|GET|List of known Partition tables (name and ID)|
|/ptables/1|GET|Description of Partition table which its ID is 1 (name and ID)|
|/puppetclasses|GET|a hash of known Puppetclasses orginazined by module name (module => {:class1, :class2})|
Please raise a new issue if you need additional API's