This is a variation of this omada example, transcribed to the new openapi. The API documentation of the softwarecontroller is in https://<omadaserver>:8043/doc.html#/home
.
I wnated to test and document the uage of the new API in itself, especially the handling of the Authorization. Working with specific endpoints is ut of scope here.
I left a lot of echo and cat statements in the code to better see what is happening. Running this on my machine i get:
{
"errorCode": 0,
"msg": "Open API Log in successfully.",
"result": {
"csrfToken": "01ee52939f8f4a739304a8c3df021a8b",
"sessionId": "d6bfeebe5df546b38cf1455f39cd71ba"
}
}
CSRFTOKEN=01ee52939f8f4a739304a8c3df021a8b
SESSIONID=d6bfeebe5df546b38cf1455f39cd71ba
{
"errorCode": 0,
"msg": "Open API Authorize successfully.",
"result": "OC-IAPAFH1wtx5fkZCfNNtKscnDRCYlfcXt"
}
AUTHCODE=OC-IAPAFH1wtx5fkZCfNNtKscnDRCYlfcXt
{
"errorCode": 0,
"msg": "Open API Get Access Token successfully.",
"result": {
"accessToken": "AT-uBtS3HaO3B6sFa7ajMIKnTJLwaecYzQS",
"tokenType": "bearer",
"expiresIn": 7200,
"refreshToken": "RT-VhdGW51kbqLjS5aCd2PZEuCnLWtbdGC8"
}
}
ACCESSTOKEN=AT-uBtS3HaO3B6sFa7ajMIKnTJLwaecYzQS
REFRESHTOKEN=RT-VhdGW51kbqLjS5aCd2PZEuCnLWtbdGC8
{
"errorCode": 0,
"msg": "Success.",
"result": {
"totalRows": 1,
"currentPage": 1,
"currentSize": 1,
"data": [
{
"siteId": "660293f1ae766909a69251d4",
"name": "FM174",
"region": "Germany",
"timeZone": "Europe/Amsterdam",
"scenario": "Home",
"type": 0
}
]
}
}
Theres no voucher or hotspot endpoints