API » History » Version 4
Frank Sweetser, 03/30/2011 12:43 PM
1 | 1 | Ohad Levy | h1. API |
---|---|---|---|
2 | |||
3 | Foreman Smart Proxy 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 Foreman Smart Proxy API. |
||
6 | |||
7 | h2. List of API's |
||
8 | |||
9 | |_.Path|_.REST Type|_.Description|_.Example Input JSON| |
||
10 | |_.FEATURES | |
||
11 | |/features|GET|List of features supported by the proxy|| |
||
12 | |_.DHCP | |
||
13 | |/dhcp|GET|Retrieve a list of subnets|| |
||
14 | |/dhcp/10.1.2.0|GET|Retrieve 10.1.2.0 subnets records|| |
||
15 | |/dhcp/10.1.2.0/10.1.2.5|GET|Retrieve 10.1.2.5 reservation information || |
||
16 | |/dhcp/10.1.2.0/unused_ip|GET|Provides an unused ip address in 10.1.2.0 subnet || |
||
17 | 3 | Paul Kelly | |/dhcp/10.1.2.0|POST|creates new reservation in 10.1.2.0 subnet |{"hostname":string, "name":string, "filename":string, "ip":string, "nextserver":string, "mac":string}| |
18 | 1 | Ohad Levy | |/dhcp/10.1.2.0/10.1.2.5|DELETE|Deletes 10.1.2.5 reservation from 10.1.2.0 subnet|| |
19 | |_.DNS | |
||
20 | |/dns|POST|Create a new DNS record|{"fqdn":string(name/ip), "value":string(ip/reverse), "type":string(A/PTR)| |
||
21 | |/dns/value|DELETE|remove value(ip or reverse) DNS record|| |
||
22 | |_.TFTP | |
||
23 | |/tftp/mac|POST|creates MAC address pxelinux configuration file|{"syslinux_config":string| |
||
24 | |/tftp/mac|DELETE|remove MAC address pxelinux configuration file|| |
||
25 | |/tftp/create_default|POST|creates a default pxelinux configuration file|{"syslinux_config":string| |
||
26 | |/tftp/fetch_boot_file|POST|creates a default pxelinux configuration file|{"prefix":string, "path":string| |
||
27 | |_.PUPPET CA | |
||
28 | |/puppet/ca|GET| list of all puppet certificates || |
||
29 | |/puppet/ca/autosign|GET| list of all puppet autosign entires || |
||
30 | |/puppet/ca/autosign/certname|POST| Add certname to Puppet autosign || |
||
31 | |/puppet/ca/autosign/certname|DELETE| Remove certname from Puppet autosign || |
||
32 | |_.PUPPET | |
||
33 | 3 | Paul Kelly | |/puppet/run|POST| Trigger puppet run / kick|["hostA", "hostB"]| |
34 | 1 | Ohad Levy | |
35 | Please raise a new issue if you need additional API's |
||
36 | 4 | Frank Sweetser | |
37 | h2. Manually Calling the API |
||
38 | |||
39 | The API can be manually tested out using curl. GET types can be retrieved like any other URL. This one, for example, will return the HTML formatted page with the list of features enabled on the proxy. |
||
40 | |||
41 | <pre> |
||
42 | curl http://localhost:8443/features |
||
43 | </pre> |
||
44 | |||
45 | POST URLs, used to create objects or trigger actions, need to have the parameters passed in via the -d argument. This curl command line will trigger a puppetrun on server.example.com. |
||
46 | <pre> |
||
47 | curl -d 'nodes=server.example.com' http://localhost:8443/puppet/run |
||
48 | </pre> |