hi, have a trouble with creating host in api
here my request:
$json = {
jsonrpc => '2.0',
method => 'host.create',
params => {
host => 'test_from_api',
output => 'extend',
interfaces => {
dns => '',
hostid => '25',
ip => '127.0.0.1',
main => '1',
port => '10050',
type => '1',
useip => '1',
},
groups => {
groupid => '2', #Linux Servers
},
},
auth => "$authID",
id => '2',
};
and im get it:
'version' => 0,
'content' => {
'jsonrpc' => '2.0',
'id' => '21',
'result' => {
'hostids' => [
'34'
]
}
},
'jsontext' => '{"jsonrpc":"2.0","result":{"hostids":["34"]},"id":"21"}',
'is_success' => 1
}, 'JSON::RPC::ReturnObject' );
all ok, i see new host in web interface, delete it... and now im trying to create host in groupid 24 (it`s already exist!!!)
same request, but groupid => '24'
now i get a lot of words in answer
the main is:
"code":-32500,"message":"Application error.","data":"No permissions to referred object or it does not exist!"
what is this!? why i can`t to create host in groupid 24?!
here my request:
$json = {
jsonrpc => '2.0',
method => 'host.create',
params => {
host => 'test_from_api',
output => 'extend',
interfaces => {
dns => '',
hostid => '25',
ip => '127.0.0.1',
main => '1',
port => '10050',
type => '1',
useip => '1',
},
groups => {
groupid => '2', #Linux Servers
},
},
auth => "$authID",
id => '2',
};
and im get it:
'version' => 0,
'content' => {
'jsonrpc' => '2.0',
'id' => '21',
'result' => {
'hostids' => [
'34'
]
}
},
'jsontext' => '{"jsonrpc":"2.0","result":{"hostids":["34"]},"id":"21"}',
'is_success' => 1
}, 'JSON::RPC::ReturnObject' );
all ok, i see new host in web interface, delete it... and now im trying to create host in groupid 24 (it`s already exist!!!)
same request, but groupid => '24'
now i get a lot of words in answer
the main is:"code":-32500,"message":"Application error.","data":"No permissions to referred object or it does not exist!"
what is this!? why i can`t to create host in groupid 24?!
Comment