- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: web api rest is not always working ...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
- Labels:
-
Access Policy
-
General
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
vm with 24 gig memory 12 cpu cores i changed the 10 seconds to 120 sec
no special results
thanks for your response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
