- CheckMates
- :
- Products
- :
- Developers
- :
- API / CLI Discussion
- :
- Re: Script for multiple network/host/group object ...
- 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
Script for multiple network/host/group object creation
Hello
We recently started with R80 Management.
One thing we would like to use is api scripts. we would like to create script that can read from csv/txt file and create network/host/group object. we have dynamic environment and new rules are requested all the time. this would reduce our time creating objects.
Is this something possible to create and could we have some example?
Thank you
Ismar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check out the the Management API guide:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes i have seen that and use many command to run manual from smartconsole cli.
would you be able to address to this automated object creation from template?
what scripting language is advised to be used etc...
some basic example would be great
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this PHP code example, we are making a call to the search endpoint and searching for the string 'Toy Story'. With the search results, we then echo out an html list of the movies and their year.
01 | <?php |
02 | $apikey = 'insert_your_api_key_here' ; |
03 | $q = urlencode( 'Toy Story' ); // make sure to url encode an query parameters |
04 |
05 | // construct the query with our apikey and the query we want to make |
06 | $endpoint = 'http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=' . $apikey . '&q=' . $q ; |
07 |
08 | // setup curl to make a call to the endpoint |
09 | $session = curl_init( $endpoint ); |
10 |
11 | // indicates that we want the response back |
12 | curl_setopt( $session , CURLOPT_RETURNTRANSFER, true); |
13 |
14 | // exec curl and get the data back |
15 | $data = curl_exec( $session ); |
16 |
17 | // remember to close the curl session once we are finished retrieveing the data |
18 | curl_close( $session ); |
19 |
20 | // decode the json data to make it easier to parse the php |
21 | $search_results = json_decode( $data ); |
22 | if ( $search_results === NULL) die ( 'Error parsing json' ); |
23 |
24 | // play with the data! |
25 | $movies = $search_results ->movies; |
26 | echo '<ul>' ; |
27 | foreach ( $movies as $movie ) { |
28 | echo '<li><a href="' . $movie ->links->alternate . '">' . $movie ->title . " (" . $movie ->year . ")</a></li>" ; |
29 | } |
30 | echo '</ul>' ; |
31 |
32 |
33 | ?> |
Once you load up this code, you should see something similar to the following:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ismar,
In the mgmt_cli there is a batch mode flag [-b] allowing you to specify a csv file to read the arguments from
All the mgmt_cli commands can use csv files instead if arguments using the -b flag
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When performing an import from CSV, how do you bypass the warning message for duplicate object (same IP, but different host name)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
add this to your API request:
ignore-warnings true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, i have seen that and use many commands to run manually from smartconsole cli.
would you be able to address to this automated object creation from a template?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check out this post for bash script examples: CLI API Example for exporting and importing different objects to a CSV file for later import
You can also find latest on my GITHUB: GitHub - mybasementcloud/R8x-export-import-api-scripts: Check Point R8x Export, Import, [and more] A...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created some steps which is effective and useful. I am using it in all my projects its simple and in PHP scrip you can check here.http://github.com/sebas5384/VirtualHost-Manager and please, help me to make it better! AssignmentBox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI,
I am writing a PowerShell module to interface with the API. One of the examples I have already written using this module is for importing group, hosts & networks into Check Point from a Excel file (Could by CSV or anything else PowerShell supports)
Links:
Hope it helps.
Regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys
Just wondering if somebody knows how to add groups with group members by importing a csv file.
So for example I need to create loads of UDP and TCP services which is no problem using mgmt_cli and csv file, but how do you add these newly created services to groups?
Let me know if further clarification to the question is needed.
