Hi PhoneBoy,
Was able to get the api.elg logs.
After executing my C# code, was able to login and get the session-ID.
But when adding a new host, that is, Running "add-host" API.
It does not adds new host.
The following are the logs from api.elg.
ID: 13
Address: http://127.0.0.1:50276/web_api/login
Encoding: ISO-8859-1
Http-Method: POST
Content-Type: application/json
Headers: {Accept=[undefined], accept-encoding=[gzip, deflate, br], Accept-Language=[en-GB,en-US;q=0.9,en;q=0.8], connection=[keep-alive], Content-Length=[38], content-type=[application/json], Host=[127.0.0.1:50276], Origin=[http://localhost:53352], Referer=[http://localhost:53352/Login.html], Sec-Fetch-Mode=[cors], Sec-Fetch-Site=[cross-site], User-Agent=[Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36], X-Forwarded-For=[192.168.70.10], X-Forwarded-Host=[192.168.70.12], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[192.168.70.12]}
--------------------------------------
2020-02-12 21:36:34,846 INFO com.checkpoint.management.web_api_is.utils.helpers.ApiCache.<init>:25 [qtp273713186-29] - Cache created and initialized
2020-02-12 21:36:34,847 INFO com.checkpoint.management.web_api.web_services.WebApiEntryPoint.logRequestedCommandInfo:132 [qtp273713186-29] - Executing [login] of version 1.1
2020-02-12 21:36:35,576 INFO com.checkpoint.management.web_api_is.utils.CsvFileWriterUtils.writeCsvLine:1 [qtp273713186-29] - 2020-02-12,21:36:35 +0530,login,PASSED,730
2020-02-12 21:36:35,587 INFO org.apache.cxf.interceptor.LoggingOutInterceptor.log:250 [qtp273713186-29] - Outbound Message
---------------------------
ID: 13
Response-Code: 200
Content-Type: application/json
Headers: {Content-Type=[application/json], Date=[Wed, 12 Feb 2020 16:06:35 GMT]}
Payload: {
"uid" : "fe8a9e54-9e6d-4e29-9bf5-ebedf6895d41",
"sid" : "WMBQBmF8Ybu6SQLHQk0Lf51Zz2gIig8lbAcoe7CQX5U",
"url" : "https://192.168.70.12:443/web_api",
"session-timeout" : 600,
"last-login-was-at" : {
"posix" : 1581523449487,
"iso-8601" : "2020-02-12T21:34+0530"
},
"api-server-version" : "1.1"
}
--------------------------------------
2020-02-12 21:37:00,583 INFO org.apache.cxf.interceptor.LoggingInInterceptor.log:250 [qtp273713186-26] - Inbound Message
----------------------------
ID: 14
Address: http://127.0.0.1:50276/web_api/add-host
Http-Method: OPTIONS
Content-Type:
Headers: {Accept=[*/*], accept-encoding=[gzip, deflate, br], Accept-Language=[en-GB,en-US;q=0.9,en;q=0.8], Access-Control-Request-Headers=[content-type,x-chkp-sid], Access-Control-Request-Method=[POST], connection=[keep-alive], Content-Type=[null], Host=[127.0.0.1:50276], Origin=[http://localhost:53352], Referer=[http://localhost:53352/AddHost.html], Sec-Fetch-Mode=[cors], Sec-Fetch-Site=[cross-site], User-Agent=[Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36], X-Forwarded-For=[192.168.70.100], X-Forwarded-Host=[192.168.70.12], X-Forwarded-Host-Port=[443], X-Forwarded-Server=[192.168.70.12]}
--------------------------------------
2020-02-12 21:37:00,583 ERROR com.checkpoint.management.web_api.core.cxf.interceptor.WebApiInInterceptorSessionValidator.handleMessage:11 [qtp273713186-26] - Session validation has failed
2020-02-12 21:37:00,584 ERROR com.checkpoint.management.web_api_is.utils.helpers.ThreadLocalStore$1.initialValue:4 [qtp273713186-26] - ThreadLocalStore.requestedVersion was requested before initialization! Initializing it with the latest API version: 1.1
2020-02-12 21:37:00,603 INFO org.apache.cxf.interceptor.LoggingOutInterceptor.log:250 [qtp273713186-26] - Outbound Message
---------------------------
ID: 14
Response-Code: 401
Content-Type: text/plain
Headers: {Content-Type=[text/plain], Date=[Wed, 12 Feb 2020 16:07:00 GMT]}
Payload: code: "generic_err_missing_session_id"
message: "Can't retrieve session id from HTTP request method: [OPTIONS]"
--------------------------------------
In Visual Basic and Browser >> Inspect >> Console it displays the error:-
Failed to load resource: the server responded with a status of 404 (Not Found) [http://localhost:53352/favicon.ico]
Access to XMLHttpRequest at 'https://192.168.70.12/web_api/add-host' from origin 'http://localhost:53352' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. [http://localhost:53352/AddHost.html]
Also, specify the changes that are to be done.!