Hello,
we need to fetch the "gateways-and-servers" by an API call.
Actually the reply of the call is "generic error".
To test the API itself we used a different call "show-unused-objects", this returns the values correctly.
Any ideas why the cal results in a generic error?
Script:
#!/bin/bash
username="1234"
password="7896"
host="10.10.18.7/"
baseurl=https://$host/web_api
curl_cmd="curl --silent --insecure -X POST"
SID=`${curl_cmd} --insecure -H "Content-Type: application/json" -d @- $baseurl/login <<. | awk -F\" '/sid/ {print $4}'
{
"user":"$username" ,
"password":"$password" ,
"session-name":"TACO"
}
.`
printf "/n"
printf $SID
outnb=`curl --insecure -XPOST "https://10.10.18.7/web_api/show-gateways-and-servers" --data-binary "{\"details-level\": \"full\"}" -H "Content-Type: application/json" -H "X-chkp-sid: $SID" -O`
##Output generic error
outnb=`curl --insecure -XPOST "https://10.10.18.7/web_api/show-unused-objects" --data-binary "{\"details-level\": \"full\"}" -H "Content-Type: application/json" -H "X-chkp-sid: $SID" -O`
##output ok
${curl_cmd} -H "Content-Type: application/json" -H "X-chkp-sid: $SID" -d "{}" $baseurl/logout
Generated files:
[xxxx ~]$ more show-gateways-and-servers
{
"code" : "generic_error",
"message" : ""
}
[xxxx ~]$ more show-unused-objects
{
"objects" : [ {
"uid" : "726480c6-b5af-44a1-b471-74539cd8e66c",
"name" : "test network name",
"type" : "network",
"domain" : {
"uid" : "a0eebc99-afed-4ef8-bb6d-fedfedfedfed",
"name" : "System Data",
"domain-type" : "mds"
},
"broadcast" : "allow",
"subnet4" : "1.2.3.0",
"mask-length4" : 24,
"subnet-mask" : "255.255.255.0",
"nat-settings" : {
"auto-rule" : false
},
"comments" : "",
"color" : "black",
"icon" : "NetworkObjects/network",
"tags" : [ ],
"meta-info" : {
"lock" : "unlocked",
"validation-state" : "ok",
"last-modify-time" : {
"posix" : 1637075180517,
"iso-8601" : "2021-11-16T16:06+0100"
},
"last-modifier" : "avccdj",
"creation-time" : {
"posix" : 1637075180517,
"iso-8601" : "2021-11-16T16:06+0100"
},
"creator" : "avccdj"
},
"read-only" : true
} ],
"from" : 1,
"to" : 1,
"total" : 1
}