Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Claudiu_Chiriac
Participant

Executing gaia-api commands using Management Api

Hello,

using the documentation at https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/gaia-api~v1.7%20 I am trying to execute a simple gaia-api command (show-hostname) against the management server, but the commands seem to fail (tried both mgmt_cli tool and web services version):

LPACAICSP1> mgmt login user admin
Enter password:
LPACAICSP1> mgmt_cli gaia-api/show-hostname target 'LPACAICSP1' --format json
MGMT9000 {
"code" : "generic_error",
"message" : "Command execution failed. Response body is empty"
}

LPACAICSP1>

 

#gaia-api/show-hostname
$URLAnon = "https://10.171.69.11/web_api/gaia-api/show-hostname"
$headers = @{
"Content-Type" = "application/json"
"X-chkp-sid" = $sid
}

$body=@{
"target" = "LPACAICSP1"#"10.171.69.11"
}
$body = $body | ConvertTo-Json
$response = Invoke-RestMethod -Method Post -Headers $headers -Uri $URLAnon -Body $body
Invoke-RestMethod : The remote server returned an error: (404) Not Found.

 

The API requests that do not use gaia-api pass OK.

 

The log entries for the two attempts:

2021-08-05 17:35:27,109 INFO org.apache.cxf.interceptor.LoggingInInterceptor.log:250 [qtp121837096-27] - Inbound Message
----------------------------
ID: 197
Address: http://127.0.0.1:50277/web_api/gaia-api/show-hostname
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {connection=[keep-alive], Content-Length=[33], content-type=[application/json], Host=[127.0.0.1:50277], User-Agent=[Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.1.19041.1023], X-chkp-sid=[e5a0ac40efccd1d7a9c1652d874fe105], X-Forwarded-For=[172.17.132.66], X-Forwarded-Host=[10.171.69.11], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[10.171.69.11]}
Payload: {
"target": "LPACAICSP1"
}
--------------------------------------
2021-08-05 17:35:27,137 WARN org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod:473 [qtp121837096-27] - No operation matching request path "/web_api/gaia-api/show-hostname" is found, Relative Path: /gaia-api/show-hostname, HTTP Method: POST, ContentType: application/json, Accept: */*,. Please enable FINE/TRACE log level for more details.
2021-08-05 17:35:27,138 WARN org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper.toResponse:73 [qtp121837096-27] - javax.ws.rs.ClientErrorException
at org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:110)

.........................................

 

2021-08-05 17:36:43,199 INFO org.apache.cxf.interceptor.LoggingInInterceptor.log:250 [qtp121837096-27] - Inbound Message
----------------------------
ID: 199
Address: http://127.0.0.1:50277/web_api/gaia-api/show-hostname
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {Accept=[application/json], connection=[keep-alive], Content-Length=[24], content-type=[application/json], Host=[127.0.0.1:50277], User-Agent=[mgmt_cli_clish], X-chkp-sid=[7999af6d4736f3c8376b563cc8c889c7], X-Forwarded-For=[127.0.0.1], X-Forwarded-Host=[127.0.0.1], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[10.171.69.11]}
Payload: {"target":"LPACAICSP1"}

--------------------------------------
2021-08-05 17:36:43,206 WARN org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod:473 [qtp121837096-27] - No operation matching request path "/web_api/gaia-api/show-hostname" is found, Relative Path: /gaia-api/show-hostname, HTTP Method: POST, ContentType: application/json, Accept: application/json,. Please enable FINE/TRACE log level for more details.
2021-08-05 17:36:43,208 WARN org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper.toResponse:73 [qtp121837096-27] - javax.ws.rs.ClientErrorException
at org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:110)
..........................................

2021-08-05 17:36:43,209 INFO org.apache.cxf.interceptor.LoggingOutInterceptor.log:250 [qtp121837096-27] - Outbound Message
---------------------------
ID: 199
Response-Code: 404
Content-Type:
Headers: {Allow=[POST, GET, OPTIONS, HEAD], Date=[Thu, 05 Aug 2021 15:36:43 GMT], Content-Length=[0]}
--------------------------------------

 

[Expert@LPACAICSP1:0]# gaia_api status

API Status:
---------------------
Build: cp991255022
Uptime: 0:14:56.810097
Current Sessions: 0
Latest Version: 1.5

Processes:

Name State PID
---------------------------------
GAIA_API Started 1478
GAIA_API_DOCS Started 1477
APACHE Started 8197
CONFD Started 8194
CLISHD Started 26614 19329 8282 1433 1147
CELERY Started 1475
REDIS Started 1476

Port Details:
-------------------
APACHE Gaia Port: 443

--------------------------------------------
Overall API Status: Started
--------------------------------------------
[Expert@LPACAICSP1:0]#

 

 

0 Kudos
1 Reply
Claudiu_Chiriac
Participant

I'm using Check Point Gaia R80.40

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events