Problem to fetch ACL list by API

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.

Problem to fetch ACL list by API

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
Problem to fetch ACL list by API
Problem to fetch ACL list by API
2024-06-02 17:35:15
Hardware Version:
Firmware Version:

I want to fetch the current ACL list of my gateway via the software Omada controller.

 

I use the following script:

 

# set variables
echo Variables set...
OMADA_URL="https://192.168.0.245:8043"
USERNAME="<ADMIN>"
PASSWORD="<PASSWORD>"
OMADASITE="6601a7b025545734a7269a8f"
SITE="demunter"
echo OK

# get controller id from the API
echo Controller ID get...
CONTROLLER_ID="$(curl -sk "${OMADA_URL}/api/info" | jq -r .result.omadacId)"
echo ${CONTROLLER_ID}
echo Done

# login, get token, set & use cookies
echo Get TOKEN...
TOKEN="$(curl -sk -X POST -c "/tmp/omada-cookies.txt" -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/login" -d '{"username": "'"${USERNAME}"'", "password": "'"${PASSWORD}"'"}' | jq -r .result.token)"
echo ${TOKEN}
echo Done

# once logged in, make sure you add the following header on additional API calls:
# -H "Csrf-Token: ${TOKEN}"

# validate login
echo Validate login...
curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/loginStatus?token=${TOKEN}" | jq .
echo Done

#get the site id
echo Get Site ID...
SITEID="$(curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${SITE}" | jq -r .result.id)"
echo ${SITEID}
echo Done

# example to get info on the current user
echo Fetch Userinfo...
curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/users/current?token=${TOKEN}&currentPage=1&currentPageSize=1000"
echo Done

#GVN: Fetch Devices
echo Fetch Devices...
curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${OMADASITE}/devices"
echo Done

#GVN: Fetch ACL
echo Fetch ACL siteid...
curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${OMADASITE}/setting/firewall/acls?&currentPage=1&currentPageSize=25&currenPage=1"
echo Done

#GVN: Fetch ACL
echo Fetch MACfilter...
curl -sk -X GET -b "/tmp/omada-cookies.txt" -H "Content-Type: application/json" -H "Csrf-Token: ${TOKEN}" "${OMADA_URL}/${CONTROLLER_ID}/api/v2/sites/${OMADASITE}/setting/firewall/macfilter?&currentPage=1&currentPageSize=25&currenPage=1"
echo Done

 

I got the following output:

Variables set...
OK
Controller ID get...
8270ae88c8d932a84f2c2445980d1a9d
Done
Get TOKEN...
6cd33e5991ef49df814e2bce5929fc24
Done
Validate login...
{
  "errorCode": 0,
  "msg": "Success.",
  "result": {
    "login": true
  }
}
Done
Get Site ID...
null
Done
Fetch Userinfo...
{"errorCode":0,"msg":"Success.","result":{"id":"6601937925545734a7269a66","type":0,"roleId":"master_admin_id","roleName":"Main Administrator","name":"<ADMIN>","email":"<EMAIL>","omadacId":"8270ae88c8d932a84f2c2445980d1a9d","alert":false,"privilege":{"sites":[{"name":"Demunter","category":"advanced","key":"6601a7b025545734a7269a8f"}],"lastVisited":"6601a7b025545734a7269a8f","lastSiteCategory":"advanced","all":true},"disaster":0,"needFeedback":true,"forceModify":false,"dbnormal":true,"view":0,"root":true,"userLevel":0}}Done
Fetch Devices...
{"errorCode":0,"msg":"Success.","result":[....]}Done
Fetch ACL siteid...
{"errorCode":-1,"msg":"General error."}Done
Fetch MACfilter...
{"errorCode":0,"msg":"Success.","result":{"enable":false}}Done

 

As you can see I can make a connection to the Omada controller. I can fetch all the devices of the site. I can also fetch the macfilter on the firewall. But the list of ACL on the firewall, I don't get. Why? What is wrong?

  0      
  0      
#1
Options