Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
yossi_Gross
Explorer

web api rest is not always working ...

hi i use the rest web api using php 

mostly when i am using the add access rule , the action does not succeed 

i just need to refresh the page few times , sometimes 5 times the action complete successfully

can someone help with the reason for that ?

0 Kudos
7 Replies
yossi_Gross
Explorer

the code i use 

$curl = curl_init();
$url = $this->checkPointMgmntServer.$Name;
showMsg('running function: ',$Name,'');
showMsg('running json: ',$json,'');
#echo $this->cpSid;
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_USERPWD, "abc:password");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // times out after 4s
curl_setopt($ch, CURLOPT_POST, 0); // set POST method
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
# curl_setopt($ch, CURLOPT_SSL_VERIFYSTATUS , FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json',
'x-chkp-sid: '.$this->cpSid

));

curl_setopt($ch, CURLOPT_POSTFIELDS, $json); // add POST fields
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json;"));
try {
$result = curl_exec($ch);
}
catch(Exception $e)
{
print_r($e);
}
$trimed = json_decode($result, true);


return $result ;

}

0 Kudos
PhoneBoy
Admin
Admin

On what hardware (CPU type, number of cores, RAM) is the R80.x Management running on?

Also, what exact version of code?

Also, what API call exactly are you making with this code?

0 Kudos
yossi_Gross
Explorer

the machine is a vm  and all functions working but the add access rule 

that succeed only once in 5 to 10 refresh of same code 

0 Kudos
yossi_Gross
Explorer

just to clarify 

i use same function to do a lot of action like adding time object adding host etc 

on all of them it runs on first time smoothly 

only when i am runnig the add access rule it fails and after some trials it is at the end succeed 

that means the json i am passing to function is ok....

but still somthing causing it to fail 

0 Kudos
PhoneBoy
Admin
Admin

This could easily be the result of an underpowered management server, which is why I asked the questions I did.

Please review my questions again and provide answers.

In the case of a VM, please tell me what ram/CPU has been allocated to it,

You also set the timeout really low (10 seconds)—you might try a higher timeout.

0 Kudos
yossi_Gross
Explorer

vm with 24 gig memory 12 cpu cores i changed the 10 seconds to 120 sec 

no special results 

thanks for your response

0 Kudos
Kaspars_Zibarts
Employee Employee
Employee

Make sure you run latest jumbo fix on your management, at least higher than 142 as there have been multiple fixes for API. Also for larger rule and objects bases switch API java to 64 bit and increase default memory heap

https://community.checkpoint.com/thread/9495-api-dying-on-mds-take-142-every-few-days 

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events