Satellite API / creating a host using json file

Posted on

Hello,
I'm trying to create host using Satellite's rest API by posting a json file as follow:

=============================================
curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u myUser:myPasswd -k -d '
{"host":
{"name":"myServerName",
"location_id": 2,
"organization_id": 1,
"environment_id": 21,
"architecture_id": 1,
"operatingsystem_id": 15,
"medium_id": 26,
"ptable_id": 146,
"hostgroup_id": 263,
"build": false,
"enabled": true,
"provision_method": "build",
"managed": true,
"compute_attributes": {
"volumes_attributes": {}
},
"content_facet_attributes": {},
"subscription_facet_attributes": {},
"overwrite": true,
"host_parameters_attributes": {},
"interfaces": {"0":
{"name": "myServerName",
"ip": "myIP",
"mac": "myMac",
"identifier": "enp94s0f0",
"type": "Nic::Managed",
"domain_id":1,
"subnet_id":205,
"primary": true,
"provision": true,
"type": "interface"}}
}

}' https://mySatellite/api/v2/hosts

{
"error": {"message":"Nic::Base(#80349020) expected, got Array(#14648600)"}
}

My satellite server is at 6.2.7 level.

Mo

Responses