Skip to content

Instantly share code, notes, and snippets.

Last active January 28, 2023 05:11
What would you like to do?
Example API Calls for Omada Controller (validated on 5.0.30)
# set variables
# get controller id from the API
CONTROLLER_ID="$(curl -sk "${OMADA_URL}/api/info" | jq -r .result.omadacId)"
# login, get token, set & use cookies
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)"
# once logged in, make sure you add the following header on additional API calls:
# -H "Csrf-Token: ${TOKEN}"
# 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 .
# example to get info on the current user
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"
Copy link

Do you have one example with the new api V3 or the documentation link?

Copy link

There's a new v3 API? I hadn't seen anything about that and it doesn't look like the app itself uses anything that's listed as a v3 API. Here is where the API documentation came from:

Post 27 has the API from version 5 of the controller:

That thread has the most info I've seen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment