Create a Post
Showing results for 
Search instead for 
Did you mean: 
Jump to solution

API - SmartConsole CLI - usual script commands like error check, if then etc.


I am sorry, but the API reference does not point out how to check for error codes, breaks, doing loops etc.

As the CLi window allows to open a file, which implies you are able to use more then one command, my expectation would be to be able to control the flow. Found no excamples. Everything I found was shell based stuff with mgmt_cli.
My actual issue i.e is to install several policies one after the other. The issue is, when the script command finished, the real task has not finished yet. So you get an error only one install can run the same time.

But this is only one example I struggled with earlier.

I've tried shell commands, but the seems not to be allowed. Did I found a further limitation of the API?

3 Replies

1. Regarding error codes/breaks/loops etc.:

This has to be done by your scripting. You can't do such things inside the window provided by SmartConsole CLI. You have to use either mgmt_cli binary or REST API.

2. Regarding access from mgmt_cli

The default API setting only allows access from localhost. Means through SmartConsole CLI or from the CLISH/BASH from the management server itself using mgmt/mgmt_cli command.

To enable access from IPs which are defined as GUI client (trusted client) or from anywhere, please refere to API documentation:

Check Point - Management API reference 


The API (and consequentially mgmt_cli and the SmartConsole CLI) is not a scripting language.

It follows the principles of REST: You send it a query, it gives you a response based on that query.

Processing the results of the query (and deciding what to do next) is a function of the program/script you write that calls the API.

The SmartConsole CLI is not a general purpose scripting engine, it merely allows you to make API calls with no scripting logic.


Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events