18 R80 REST API Lab
18 R80 REST API Lab
18 R80 REST API Lab
R80.10 Training
(revised: September 14, 2018)
Keep
Downloads test-files/R80
• Browse to
https://192.168.101.254/api_doc
and you should see the API
reference.
Review Questions
add host
• Copy the first example command “add host” with the two
required name/value pairs.
Add host
©2017 Check Point Software Technologies Ltd. [Confidential] For designated groups and individuals 12
Rest API Lab
SmartConsole GUI
• Open students.txt in the test-files/R80 folder.
• This creates 3 networks, a network group object and
adds the 3 new networks to the new group.
©2017 Check Point Software Technologies Ltd. [Confidential] For designated groups and individuals 13
Rest API Lab
SmartConsole GUI
• Press the up arrow and press enter to repeat one of
the last commands and notice the error.
• To debug the API, from expert mode in the CLI you
can look for errors in /etc/fw/log/api.elg. Enter publish
to try to publish the changes. Exit the window.
Exit
©2017 Check Point Software Technologies Ltd. [Confidential] For designated groups and individuals 14
Rest API Lab
SmartConsole GUI
• In SmartConsole go to MANAGE & SETTINGS ->
Sessions -> View Sessions.
• Notice all of the changes are done in the current admin
session and the Application is SmartConsole.
©2017 Check Point Software Technologies Ltd. [Confidential] For designated groups and individuals 15
Rest API Lab
Web services operational flow
A typical R80 API session starts with a login.
Send
Login Rest Publish Logout
Action
https://<ip>/web_api/login https://<ip>/web_api/add-host https://<ip>/web_api/publish https://<ip>/web_api/logout
Install
Policy
https://<ip>/web_api/install_policy
• Go to MANAGE &
SETTINGS -> Permissions &
Administrators ->
Administrators.
©2017 Check Point Software Technologies Ltd. [Confidential] For designated groups and individuals 17
REST API Lab
Web Services
• In the Management API reference click Web Services in the
API Overview section. Review as you like.
• One tool we can use to facilitate web development is the
Chrome postman add-on.
• In the Chrome browser, search for Chrome postman.
• In the chrome web store, click on ADD TO CHROME.
Add
Import
Note: The file can also be downloaded from the Check Point community:
https://community.checkpoint.com/docs/DOC-2183. Unzip the file to import it.
©2017 Check Point Software Technologies Ltd. 19
REST API Lab
Web Services
Note: In addition to the browser add-on, Postman has native apps. In the Windows,
MacOS and Linux native app you’ll want to disable SSL certificate verification.
In the Chrome Add-on we’re using this is not needed.
See https://www.getpostman.com/docs/postman/launching_postman/settings.
disable
Collections
login
Server
Environment
Gear icon
Name
R80
update
add-host
Code
• One by one copy the commands below into the DOS command window.
• As you like check the audit log to see the results of each command.
cd \Users\jroberts\Desktop\test-files\R80
%R80PATH%\mgmt_cli add host name "host7" ip-address "10.10.10.7" -u "api-user" -p "Cpwins1!" -m 192.168.101.254
• Or you can also create your own by logging into the Gaia Web UI: https://192.168.101.254.
• Click Add, set the password, set the Role to adminRole and set the Shell to /bin/bash.
/bin/bash
Review Questions