RESTful API
Enabling and disabling the REST API
To enable REST API on the gateway, run this Gaia Clish command:
| 
 | 
To disable REST API on the gateway, run this Gaia Clish command:
| 
 | 
Request Structure
HTTP Post
| 
 | 
The default port number is 4434.
HTTP Headers
| Header | Description | 
|---|---|
| 
 | application/json | 
| 
 | Session ID token as returned by the login command. 
 | 
Request payload
Text in JSON format containing the different parameters.
Example:
| 
 | 
Response Structure
Returned value on Success:
- 
                                                    HTTP status 200 (OK) 
- 
                                                    A JSON string (content varies depending on which API is called) 
Returned value on failure:
- 
                                                    HTTP status 500 (Internal Server Error), 400 (Bad Request), or 401 (Unauthorized) 
- 
                                                    A JSON structure with the error details 
Versioning
HTTP Post with a specific version
| 
 | 
If no version is being sent, the latest supported version is used.
Example:
| 
 | 
REST API Commands
(1) Login
Description
- 
                                                    Log in to the SMB appliance with your SMB admin username and password. 
- 
                                                    The SMB returns your session unique identifier. 
- 
                                                    Enter this session unique identifier in the x-chkp-sidheader of each request.
Request URL
| 
 | 
Request Headers
| Header Name | Value | Description | 
|---|---|---|
| 
 | application/json | Send JSON object to use the API Web Services. | 
Request Body
| Parameter Name | Value | Description | 
|---|---|---|
| 
 | String | Administrator username | 
| 
 | String | Administrator password | 
Response
On Success, HTTP Return code: 200
| Header Name | Value | Description | 
|---|---|---|
| 
 | String | Session unique identifier for the  | 
| 
 | String | The administrator role and permissions. | 
| 
 | Boolean | True if the session is read only. | 
| 
 | String | API server version. | 
| 
 | Integer | Session expiration timeout in minutes. | 
On Failure, HTTP Return code: 400, 401, 500
Example Request
| { "user": "admin", "password": "aa" } | 
Example Response
| { "sid": "9aa5770044797d7209f8ce9b0ef0fa0", "role": "ROLE.SUPER", "read-only": false, "api-server-version": "v1", "session-timeout": 10 } | 
(2) Logout
Description
Log out from the current session. After you log out, the session id is no longer valid.
Request URL
| 
 | 
Request Headers
| Header Name | Value | Description | 
|---|---|---|
| 
 | application/json | Send JSON object to use the API Web Services. | 
| 
 | string token | Session unique identifier as the response to the login request. | 
Request Body
There is no request body.
Response
On Success, HTTP Return code: 200
On Failure, HTTP Return code: 400, 401, 500
(3) Generate-Report
Description
Generate security report data according to the selected time frame:
Hourly/Daily/Weekly/Monthly
                                            
Request URL
POST https://<gateway-ip>:<port>/web-api/generate-report
                                            
Request Headers
| Header Name | Value | Description | 
|---|---|---|
| 
 | application/json | Send JSON object to use the API Web Services. | 
| 
 | string token | Session unique identifier as the response to the login request. | 
Request Body
| Header Name | Value | Description | 
|---|---|---|
| 
 | String | Report time frame. Allow values:  | 
Response
On Success, HTTP Return code: 200
| Header Name | Value | Description | 
|---|---|---|
| 
 | Base64 string | Send data JSON in base64 format. | 
On Failure, HTTP Return code: 400, 401, 500
Example Request
| { "type": "daily", } | 
Example Response
| [ { "reportData": "<report_json_in_base64_format>" } ] | 
(4) Run-Clish-Command
Description
Run a single Gaia Clish The default shell of the Gaia CLI command.
 The default shell of the Gaia CLI command.
Request URL
| 
 | 
Request Headers
| Header Name | Value | Description | 
|---|---|---|
| 
 | application/json | Send JSON object to use the API Web Services. | 
| 
 | string token | Session unique identifier as the response to the login request. | 
Request Body
| Header Name | Value | Description | 
|---|---|---|
| 
 | String | A single clish command in base64 format. | 
Response
On Success, HTTP Return code: 200
| Header Name | Value | Description | 
|---|---|---|
| 
 | String | Clish command output in base64 format. | 
On Failure, HTTP Return code: 400, 401, 500
Example Request
| { "script": " c2hvdyBwcm94eQ==" } | 
Example Response
| { "output": "dXNlLXByb3h5OiAgICAgICAgICAgICAgICAgICAgdHJ1ZQpzZXJ2ZXI6IC AgICAgICAgICAgICAgICAgICAgICAxLjEuMS4xCnBvcnQ6ICAgICAgICAgICAgICAgICAgICAg ICAgIDgwODAKCg==" } | 
The script is:
| 
 | 
The output is:
| use-proxy: true server: proxy.checkpoint.com port: 8080 | 
