Json-fact-format » History » Revision 7
Revision 6 (Marek Hulán, 12/17/2013 01:37 PM) → Revision 7/8 (Marek Hulán, 01/26/2014 11:24 AM)
h1. Json-fact-format h3. how to send facts * Foreman reports need to be sent to /api/hosts/facts * Following headers needs to be present: <pre> "Accept: application/json,version=2" "Content-Type: application/json" </pre> h3. facts JSON format <pre><code class="json"> <pre> { "name" : => "fqdn.example.com", "certname" : => "optional.certname.for.this.host", "facts" : => { "fact1" : => "value", "fact2" : => "value", "fact2::nested:fact" : => "value", "_timestamp" : => "2013-10-18 07:47:45 +0000", "_type" : "puppet", => "puppet" "operatingsystem" : "Debian", => 'Debian', "operatingsystemrelease" : "7.0" => '7.0' } } </code></pre> </pre> Note that _timestamp, operatingsystem and operatingsystemrelease are mandatory. Certname is optional, but if provided it will be preferred over name to identify the host object in the db. _type identifies source of fact, currently only puppet is supported by Foreman core and is also a default value if unspecified. If you want to add another fact type, you can register your importer class in FactImporter.register_fact_importer. For more info and example see https://github.com/ares/foreman_chef