products:software:edgeos:api

This is an old revision of the document!


Preliminary exploration of EdgeOS web APIs.

Logging in

Session is valid for 15 minutes and is refreshed on every web request. POST to https://host-or-ip/ form data username and password. GET https://host-or-ip/api/edge/get.json can be used to get a json formatted dict containing the config and the current SESSION_ID.

Session can be extended with api/edge/heartbeat.json?_=1528820201273

Websocket

You can get streaming statistical data from the endpoint wss://host-or-ip/ws/stats. The connection *MUST* have the origin header set to 'https://host-or-ip'. The format of data to and from the websocket is "LENGTH\nJSON_PAYLOAD". Error 403 on handshake is likely due to lack of 'origin' header as needed. Failure of sending properly formed messages to start the streaming will result in no messages from server aka "dead air". When the SESSION_ID times out the websocket will abruptly close so it's recommended to refresh it occasionally.

249
{"SUBSCRIBE":[{"name":"export"},{"name":"discover"},{"name":"pon-stats"},{"name":"interfaces"},{"name":"system-stats"},{"name":"num-routes"},{"name":"config-change"},{"name":"users"}],"UNSUBSCRIBE":[],"SESSION_ID":"b5d5cfdb326c484abb00ca0d9effffff"}

Return values from the stream follow a similar format.

104
{
    "system-stats":
    {
        "cpu": "10",
        "uptime": "57864",
        "mem": "60"
    }
}

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/nevyxvrt/ubntwiki.com/lib/plugins/authplain/auth.php on line 446
dokuwiki\Exception\FatalException: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

dokuwiki\Exception\FatalException: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the authplain plugin.

More info has been written to the DokuWiki error log.