Plugin for Foreman & Katello API v2.1, which is based on v2 controllers but uses the response format according to the jsonapi.org specification.
See How_to_Install_a_Plugin for how to install Foreman plugins
gem 'foretello_api_v21', :git => 'https://github.com/fusor/foretello_api_v21.git
GET http://example.com/api/v21/hosts
The foremat changes from v2 to v2.1 over v2 are in four main areas as follows:
POST /api/v2/puppetclasses/33/smart_class_parameters/44/override_values
POST /api/v21/override_values?puppetclass_id=33&smart_class_parameter_id=44
For Collections
GET /api/v2/domains
{ results: [{
...
}
]
}
GET /api/v21/domains
{ domains: [{
...
}
]
}
For Single Objects
GET /api/v2/domains/1
{ id: 1,
...
}
GET /api/v21/domains
{ domain: {
id: 1,
...
}
}
GET /api/v2/hostgroups/1
{
"id": 1,
"name": "base",
"puppetclasses": [
{
"id": 421,
"name": "apache2::php",
"module_name": "apache2"
},
{
"id": 1162,
"name": "apache::mod::cgi",
"module_name": "apache"
}
]
}
GET /api/v21/hostgroups/1
{
"hostgroup": {
"id": 1,
"name": "Base",
"puppetclass_ids": [
421,
1162
]
},
],
"puppetclasses": [
{
"id": 421,
"name": "apache2::php",
"created_at": "2012-07-01T10:00:16+03:00",
"updated_at": "2015-02-04T13:28:37+02:00"
},
{
"id": 1162,
"name": "apache::mod::cgi",
"created_at": "2014-01-27T15:48:57+02:00",
"updated_at": "2015-02-04T13:28:39+02:00"
}
]
}
TBD
Fork and send a Pull Request. Thanks!
Copyright (c) year your name
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.