Hi,
I'm having trouble creating a single host via the API.
I read this http://theforeman.org/api/apidoc/hosts/create.html and tried to
create a host using the provided example.
curl -s -k https://admin:admin@puppet.lan.basjes.nl/api/hosts?format=json
-d'< THE EXACT JSON FROM THE PAGE >'
I got the following error:
{"host":{"id":null,"errors":{"name":["can't be
blank"],"environment_id":["can't be blank"],"root_pass":["should be 8
characters or more"]},"full_messages":["Name can't be blank","Environment
can't be blank","Root pass should be 8 characters or more"]}}
I interpreted this as "I forgot some settings".
So I retrieved the existing test host (virtual) using
curl -s -k
https://admin:admin@puppet.lan.basjes.nl/api/hosts/pxetest.lan.basjes.nl
and then I did a
curl -s -k https://admin:admin@puppet.lan.basjes.nl/api/hosts?format=json
-d'< THE EXACT JSON I GTO FROM THE PREVIOUS COMMAND >'
Resulting in the exact same error.
There is one thing I noticed that is different: All the ids for domains,
environments, architectures, … on my test installation here are '1', '2',
'3', etc. instead of '254219264', '980190962', etc.as shown in the
documentation.
Niels Basjes