API » History » Version 6
Ohad Levy, 11/07/2010 02:00 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 | 5 | Ohad Levy | |/dashboard|GET|Summary statistcs (total hosts, active hosts, hosts in error etc)| |
32 | 1 | Ohad Levy | |/domains|GET|List of known domains (name and ID)| |
33 | |/domains/my_domain|GET|Description of "my_domain" (name and ID)| |
||
34 | |/environments|GET|List of known environments (name and ID)| |
||
35 | |/environments/production|GET|Description of the "production" (name and ID and associated host list)| |
||
36 | |/fact_values|GET|List of known Facts (value, name and host)| |
||
37 | |/hostgroups|GET|List of known hostgroups (name and ID)| |
||
38 | |/hostgroups/common|GET|Description of "common" (name and ID)| |
||
39 | |/hosts|GET|List of known hosts (only name)| |
||
40 | 4 | Ohad Levy | |/hosts/errors|GET|List of hosts in error state(only name)| |
41 | |/hosts/active|GET|List of active hosts(only name)| |
||
42 | |/hosts/out_of_sync|GET|List of out of sync hosts(only name)| |
||
43 | |/hosts/disabled|GET|List of disabled hosts(only name)| |
||
44 | 1 | Ohad Levy | |/hosts|POST|creates a new host, 201 return sucesful creation, otherwise the errors will be returned| |
45 | |/hosts/fqdn|GET|Host Attributes (name, usergroup, last_report, os properties...)| |
||
46 | |/hosts/fqdn|DELETE|Removes the host "fqdn"| |
||
47 | |/hosts/fqdn/setBuild|GET| Enable Host for (re-)build | |
||
48 | |/hosts/fqdn/facts|GET| Returns host facts| |
||
49 | 6 | Ohad Levy | |/hosts/fqdn/pxe_config|GET| Returns syslinux configuration file for fqdn| |
50 | 1 | Ohad Levy | |/medias|GET|List of known mediums (name and ID)| |
51 | |/medias/1|GET|Description of media which ID is 1 (name and ID and path/url)| |
||
52 | |/operatingsystems|GET|List of known operating systems (Release name, ID and allowed mediums, architectures and partition tables)| |
||
53 | |/operatingsystems/1|GET| Description of operating systems which its ID is 1 (Release name, ID and allowed mediums, architectures and partition tables)| |
||
54 | |/ptables|GET|List of known Partition tables (name and ID)| |
||
55 | |/ptables/1|GET|Description of Partition table which its ID is 1 (name and ID)| |
||
56 | |/puppetclasses|GET|a hash of known Puppetclasses orginazined by module name (module => {:class1, :class2})| |
||
57 | 3 | Ohad Levy | |
58 | |||
59 | |||
60 | Please raise a new issue if you need additional API's |