Anybody have any idea why I'm getting the following message:
Unprocessable entity Host::Managed (id: new):
Name can't be blank
Environment can't be blank
When I try and create hosts via the API. I've verified that I've included
the information correctly. The json is also valid.
Here's what I'm doing with curl. I have included both name and environment:
curl -XPOST -s -d'{"host": {"operatingsystem_id": 1, "mac":
"00:25:B5:10:00:6E", "environment_id": "1", "architecture_id": 2, "name":
"dalindexstore01", "ip": "10.10.28.201", "domain_id": 2, "puppet_proxy_id":
9, "hostgroup_id": 1}}' -k -u user:pass "
https://myforemaninstall.com/api/hosts"
The result I get back is this:
{
"host": {
"errors": {
"environment_id": [
"can't be blank"
],
"name": [
"can't be blank"
]
},
"full_messages": [
"Name can't be blank",
"Environment can't be blank"
],
"id": null
}
}
On the foreman logs I see this:
tarted POST "/api/hosts" for 192.168.42.222 at Wed Oct 23 22:44:12 +0000
2013
Processing by Api::V1::HostsController#create as JSON
Parameters: {"{"host": {"operatingsystem_id": 1, "mac":
"00:25:B5:10:00:6E", "environment_id": "1", "architecture_id": 2,
"name": "dalindexstore01", "ip": "10.10.28.201", "domain_id": 2,
"puppet_proxy_id": 9, "hostgroup_id": 1}}"=>nil}
Unprocessable entity Host::Managed (id: new):
Name can't be blank
Environment can't be blank
Rendered api/v1/errors/unprocessable_entity.json.rabl (1.7ms)
Completed 422 Unprocessable Entity in 25ms (Views: 2.5ms | ActiveRecord:
3.3ms)