Project

General

Profile

API » History » Version 4

Ohad Levy, 11/04/2010 10:41 AM

1 1 Ohad Levy
h1. API
2
3
Foreman provides a "REST":http://en.wikipedia.org/wiki/Representational_State_Transfer API, communicating via JSON.
4
5
Please refer to this document for latest information about API structure.
6
7
Examples below are either via curl or ruby rest_client
8
9
most pages can be browsed via adding the format option to the url (at least for get requests), i.e.
10
11
<pre>
12
http://foreman/environemnts?format=json
13
</pre>
14
15
Or using HTTP Headers
16
<pre>
17
curl -H "Content-Type:application/json" -H "Accept:application/json"  http://foreman/hosts
18
</pre>
19
20
Output is JSON formatted, in the last example expect a similar output:
21
22
<pre>
23
[{"host":{"name":"pm.local.net"}},{"host":{"name":"pm.local.net"}}....]
24
</pre>
25
26 3 Ohad Levy
h2. List of API's
27 1 Ohad Levy
28
|_.Path|_.REST Type|_.Description|
29
|/architectures|GET|List of valid OS Architectures(name and ID)|
30
|/architectures/x86_64|GET|Description of the x86_64 Architecture (name and ID)|
31
|/domains|GET|List of known domains (name and ID)|
32
|/domains/my_domain|GET|Description of "my_domain" (name and ID)|
33
|/environments|GET|List of known environments (name and ID)|
34
|/environments/production|GET|Description of the "production" (name and ID and associated host list)|
35
|/fact_values|GET|List of known Facts (value, name and host)|
36
|/hostgroups|GET|List of known hostgroups (name and ID)|
37
|/hostgroups/common|GET|Description of "common" (name and ID)|
38
|/hosts|GET|List of known hosts (only name)|
39 4 Ohad Levy
|/hosts/errors|GET|List of hosts in error state(only name)|
40
|/hosts/active|GET|List of active hosts(only name)|
41
|/hosts/out_of_sync|GET|List of out of sync hosts(only name)|
42
|/hosts/disabled|GET|List of disabled hosts(only name)|
43 1 Ohad Levy
|/hosts|POST|creates a new host, 201 return sucesful creation, otherwise the errors will be returned|
44
|/hosts/fqdn|GET|Host Attributes (name, usergroup, last_report, os properties...)|
45
|/hosts/fqdn|DELETE|Removes the host "fqdn"|
46
|/hosts/fqdn/setBuild|GET| Enable Host for (re-)build |
47
|/hosts/fqdn/facts|GET| Returns host facts|
48
|/medias|GET|List of known mediums (name and ID)|
49
|/medias/1|GET|Description of media which ID is 1 (name and ID and path/url)|
50
|/operatingsystems|GET|List of known operating systems (Release name, ID and allowed mediums, architectures and partition tables)|
51
|/operatingsystems/1|GET| Description of operating systems which its ID is 1 (Release name, ID and allowed mediums, architectures and partition tables)|
52
|/ptables|GET|List of known Partition tables (name and ID)|
53
|/ptables/1|GET|Description of Partition table which its ID is 1 (name and ID)|
54
|/puppetclasses|GET|a hash of known Puppetclasses orginazined by module name (module => {:class1, :class2})|
55 3 Ohad Levy
56
57
58
Please raise a new issue if you need additional API's