Project

General

Profile

Actions

API » History » Revision 1

Revision 1/45 | Next »
Ohad Levy, 10/17/2010 02:33 PM


API

Foreman provides a REST 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.

http://foreman/environemnts?format=json

Or using HTTP Headers

curl -H "Content-Type:application/json" -H "Accept:application/json"  http://foreman/hosts

Output is JSON formatted, in the last example expect a similar output:

[{"host":{"name":"pm.local.net"}},{"host":{"name":"pm.local.net"}}....]

at the moment, the following controllers are enabled

|_.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)| |/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|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})

Updated by Ohad Levy about 14 years ago · 45 revisions