Project

General

Profile

API » History » Version 8

Ohad Levy, 11/09/2010 03:15 PM

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