Can't create webscenario / debug?
akosveres opened this issue · 2 comments
Hi,
I was wondering if there's a way to debug the API calls that go to the server. I'm trying to create webscenarios but I get an error of "API error -32602: Web scenario step name cannot be empty."
The code is:
try {
$api = new ZabbixApi($server, $user, $password);
$create = $api->httptestCreate(array(
'name' => 'Puckin Test',
'hostid' => '10082',
'steps' => array(
'name' => 'puckin',
'url' => 'http://puck.in',
'status_codes' => 200,
'no' => 1)
));
foreach($create as $created)
echo $created->httptestids;
}
catch(Exception $e)
{
// Exception in ZabbixApi catched
echo $e->getMessage();
}
Thank you for your feedback.
Never mind, I figured it out, in case anyone else bumps in to this, the solution is a double array, like:
try {
$api = new ZabbixApi($server, $user, $password);
$params = array(
'name' => 'Puckin Test',
'hostid' => '10082',
'steps' => array(array('name' => 'puckin',
'url' => 'http://puck.in',
'status_codes' => '200',
'no' => '1')
));
$create = $api->httptestCreate($params);
foreach($create as $created)
echo $created->httptestids;
}
catch(Exception $e)
{
// Exception in ZabbixApi catched
echo $e->getMessage();
}
Thanks for the solution @akosveres ;)