Project

General

Profile

API » History » Version 3

Ohad Levy, 10/17/2010 02:35 PM

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
|/hosts|POST|creates a new host, 201 return sucesful creation, otherwise the errors will be returned|
40
|/hosts/fqdn|GET|Host Attributes (name, usergroup, last_report, os properties...)|
41
|/hosts/fqdn|DELETE|Removes the host "fqdn"|
42
|/hosts/fqdn/setBuild|GET| Enable Host for (re-)build |
43
|/hosts/fqdn/facts|GET| Returns host facts|
44
|/medias|GET|List of known mediums (name and ID)|
45
|/medias/1|GET|Description of media which ID is 1 (name and ID and path/url)|
46
|/operatingsystems|GET|List of known operating systems (Release name, ID and allowed mediums, architectures and partition tables)|
47
|/operatingsystems/1|GET| Description of operating systems which its ID is 1 (Release name, ID and allowed mediums, architectures and partition tables)|
48
|/ptables|GET|List of known Partition tables (name and ID)|
49
|/ptables/1|GET|Description of Partition table which its ID is 1 (name and ID)|
50
|/puppetclasses|GET|a hash of known Puppetclasses orginazined by module name (module => {:class1, :class2})|
51 3 Ohad Levy
52
53
54
Please raise a new issue if you need additional API's