Ubiquiti EdgeOS Go Client
This commit is contained in:
82
pkg/edgeos/contrib/api.md
Normal file
82
pkg/edgeos/contrib/api.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Auth
|
||||
- POST to /api/v1.0/users/login, application/json, `{username: "user", password: "password"}`
|
||||
- Response contains x-auth-token header
|
||||
- Successful response payload: `{"statusCode":200,"error":0,"detail":"User account
|
||||
valid.","message":"Success"}`
|
||||
- Failure payload: `{"statusCode":401,"error":1,"detail":"User account invalid...","message":"Failure"}`
|
||||
- Use token until 401 responses, then refresh
|
||||
|
||||
# Endpoints
|
||||
|
||||
## Interfaces
|
||||
|
||||
**GET /api/v1.0/interfaces**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
[{"identification":{"id":"0\/1","name":"Switch-Main","mac":"00:11:22:33:44:55","type":"port"},"status":{"enabled":true,"plugged":true,"currentSpeed":"100-full","speed":"auto","mtu":1518},"addresses":[{"type":"static","version":"v4","cidr":"192.168.1.10\/24","eui64":false}],"port":{"stp":{"enabled":true,"edgePort":"disable","pathCost":0,"portPriority":128,"state":"disabled"},"poe":"off","flowControl":true,"routed":false,"pingWatchdog":{"enabled":false,"address":"","failureCount":3,"interval":15,"offDelay":5,"startDelay":300}}},{"identification":{"id":"0\/2","name":"Access Point","mac":"00:11:22:33:44:55","type":"port"},"status":{"enabled":true,"plugged":true,"currentSpeed":"1000-full","speed":"auto","mtu":1518},"addresses":[{"type":"static","version":"v4","cidr":"192.168.1.10\/24","eui64":false}],"port":{"stp":{"enabled":true,"edgePort":"disable","pathCost":0,"portPriority":128,"state":"disabled"},"poe":"24v","flowControl":true,"routed":false,"pingWatchdog":{"enabled":false,"address":"192.168.1.20","failureCount":3,"interval":30,"offDelay":5,"startDelay":300}}},{"identification":{"id":"0\/3","name":"Camera-Front","mac":"00:11:22:33:44:55","type":"port"},"status":{"enabled":true,"plugged":true,"currentSpeed":"100-full","speed":"auto","mtu":1518},"addresses":[],"port":{"stp":{"enabled":true,"edgePort":"disable","pathCost":0,"portPriority":128,"state":"disabled"},"poe":"48v","flowControl":true,"routed":false,"pingWatchdog":{"enabled":false,"address":"","failureCount":3,"interval":15,"offDelay":5,"startDelay":300}}},{"identification":{"id":"0\/4","name":"Camera-Back","mac":"00:11:22:33:44:55","type":"port"},"status":{"enabled":true,"plugged":true,"currentSpeed":"100-full","speed":"auto","mtu":1518},"addresses":[],"port":{"stp":{"enabled":true,"edgePort":"disable","pathCost":0,"portPriority":128,"state":"disabled"},"poe":"24v","flowControl":true,"routed":false,"pingWatchdog":{"enabled":false,"address":"","failureCount":3,"interval":15,"offDelay":5,"startDelay":300}}},{"identification"...
|
||||
```
|
||||
|
||||
## Device
|
||||
|
||||
**GET /api/v1.0/device**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"errorCodes":[],"identification":{"mac":"00:11:22:33:44:55","model":"TSW-PoE PRO","family":"EdgeSwitch-XP","subsystemID":"e702","firmwareVersion":"2.2.1","firmware":"SW.ar7240.v2.2.1.165.240717.1112","product":"EdgeSwitch 8XP","serverVersion":"1.4.0-222-gb5269d7","bridgeVersion":"0.33.0-dev-9-gdebf0c5"},"capabilities":{"interfaces":[{"id":"0\/1","type":"port","supportBlock":true,"supportDelete":false,"supportReset":true,"configurable":true,"supportDHCPSnooping":false,"supportIsolate":false,"supportAutoEdge":false,"maxMTU":9720,"supportPOE":true,"supportCableTest":false,"poeValues":["off","24v","48v"],"media":"GE","speedValues":["auto","10-half","10-full","100-half","100-full"]},{"id":"0\/2","type":"port","supportBlock":true,"supportDelete":false,"supportReset":true,"configurable":true,"supportDHCPSnooping":false,"supportIsolate":false,"supportAutoEdge":false,"maxMTU":9720,"supportPOE":true,"supportCableTest":false,"poeValues":["off","24v","48v"],"media":"GE","speedValues":["auto","10-half","10-full","100-half","100-full"]},{"id":"0\/3","type":"port","supportBlock":true,"supportDelete":false,"supportReset":true,"configurable":true,"supportDHCPSnooping":false,"supportIsolate":false,"supportAutoEdge":false,"maxMTU":9720,"supportPOE":true,"supportCableTest":false,"poeValues":["off","24v","48v"],"media":"GE","speedValues":["auto","10-half","10-full","100-half","100-full"]},{"id":"0\/4","type":"port","supportBlock":true,"supportDelete":false,"supportReset":true,"configurable":true,"supportDHCPSnooping":false,"supportIsolate":false,"supportAutoEdge":false,"maxMTU":9720,"supportPOE":true,"supportCableTest":false,"poeValues":["off","24v","48v"],"media":"GE","speedValues":["auto","10-half","10-full","100-half","100-full"]},{"id":"0\/5","type":"port","supportBlock":true,"supportDelete":false,"supportReset":true,"configurable":true,"supportDHCPSnooping":false,"supportIsolate":false,"supportAutoEdge":false,"maxMTU":9720,"supportPOE":true,"supportCableTest":false,"poeValues":["o...
|
||||
```
|
||||
|
||||
## System
|
||||
|
||||
**GET /api/v1.0/system**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"hostname":"Switch-01","timezone":"UTC","domainName":"","factoryDefault":false,"stp":{"enabled":false,"version":"RSTP","maxAge":6,"helloTime":2,"forwardDelay":4,"priority":32768},"analyticsEnabled":false,"dnsServers":[{"type":"static","version":"v4","address":"192.168.1.1"},{"type":"static","version":"v4","address":"8.8.8.8"}],"defaultGateway":[{"type":"static","version":"v4","address":"192.168.1.1"}],"users":[{"username":"admin","readOnly":false,"sshKeys":[]}],"management":{"vlanID":1,"managementPortOnly":false,"addresses":[{"type":"static","version":"v4","cidr":"192.168.1.10\/24","eui64":false}]}}
|
||||
```
|
||||
|
||||
|
||||
## VLANs
|
||||
|
||||
**GET /api/v1.0/vlans**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"trunks":[{"interface":{"id":"0\/8","name":"Uplink","mac":"00:11:22:33:44:55","type":"port"}}],"vlans":[{"name":"Management","type":"single","id":1,"participation":[{"interface":{"id":"0\/1","name":"Switch-Main","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/2","name":"Access Point","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/7","name":"Switch-Secondary","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/8","name":"Uplink","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"}]},{"name":"Security","type":"single","id":250,"participation":[{"interface":{"id":"0\/2","name":"Access Point","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"},{"interface":{"id":"0\/3","name":"Camera-Front","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/4","name":"Camera-Back","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/5","name":"WISP AP","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/6","name":"Shop Cam","mac":"00:11:22:33:44:55","type":"port"},"mode":"untagged"},{"interface":{"id":"0\/7","name":"Switch-Secondary","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"},{"interface":{"id":"0\/8","name":"Uplink","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"}]},{"name":"WISP","type":"single","id":500,"participation":[{"interface":{"id":"0\/7","name":"Switch-Secondary","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"},{"interface":{"id":"0\/8","name":"Uplink","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"}]},{"name":"Guest","type":"single","id":750,"participation":[{"interface":{"id":"0\/2","name":"Access Point","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"},{"interface":{"id":"0\/7","name":"Switch-Secondary","mac":"00:11:22:33:44:55","type":"port"},"mode":"tagged"},{"interface":{"id":"0\/8","name":"Uplink",...
|
||||
```
|
||||
|
||||
## Services
|
||||
|
||||
**GET /api/v1.0/services**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{"discoveryResponder":{"enabled":true},"sshServer":{"enabled":true,"sshPort":22,"passwordAuthentication":true},"telnetServer":{"enabled":false,"port":23},"webServer":{"enabled":true,"httpPort":80,"httpsPort":443},"systemLog":{"enabled":true,"port":514,"server":"192.168.1.50","level":"info"},"ntpClient":{"enabled":true,"ntpServers":["192.168.1.1","pool.ntp.org"]},"unms":{"enabled":true,"key":"wss:\/\/unms.example.com:443+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+allowUntrustedCertificate","status":"connecting"},"lldp":{"enabled":true},"snmpAgent":{"enabled":true,"community":"public","contact":"Admin","location":"Server Room"},"ddns":{"enabled":false,"clients":[{"hostname":"","service":"dyndns_org","username":"","password":""}]}}
|
||||
```
|
||||
|
||||
## Statistics
|
||||
|
||||
**GET /api/v1.0/statistics**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
[{"timestamp":1767542414936,"device":{"cpu":[{"identifier":"MIPS 24Kc V7.4","usage":29}],"ram":{"usage":16,"free":53293056,"total":63479808},"temperatures":[],"storage":[{"name":"\/ (rootfs)","type":"other","sysName":"rootfs","used":4718592,"size":4718592},{"name":"\/ (squashfs)","type":"other","sysName":"\/dev\/root","used":4718592,"size":4718592},{"name":"\/var (tmpfs)","type":"other","sysName":"tmpfs","used":868352,"size":9437184},{"name":"\/dev (tmpfs)","type":"other","sysName":"dev","used":0,"size":31739904}],"uptime":1789723},"interfaces":[{"id":"0\/1","name":"Switch-Main","statistics":{"dropped":0,"txDropped":0,"rxDropped":0,"errors":0,"txErrors":0,"rxErrors":0,"rate":2198,"txRate":2198,"rxRate":0,"bytes":0,"txBytes":1422812962,"rxBytes":28554596,"packets":0,"txPackets":12985860,"rxPackets":340667,"pps":3,"txPPS":3,"rxPPS":0,"txJumbo":0,"rxJumbo":0,"rxFlowCtrl":0,"txBroadcast":8282188,"rxBroadcast":97324,"txMulticast":4339420,"rxMulticast":18}},{"id":"0\/2","name":"Access Point","statistics":{"dropped":0,"txDropped":0,"rxDropped":0,"errors":0,"txErrors":0,"rxErrors":0,"rate":248172,"txRate":34387,"rxRate":213785,"bytes":0,"txBytes":14413696328,"rxBytes":2347117438,"packets":0,"txPackets":28331501,"rxPackets":10615209,"pps":57,"txPPS":25,"rxPPS":32,"txJumbo":0,"rxJumbo":0,"rxFlowCtrl":0,"txBroadcast":9467127,"rxBroadcast":710595,"txMulticast":4590381,"rxMulticast":115771}},{"id":"0\/3","name":"Camera-Front","statistics":{"dropped":0,"txDropped":0,"rxDropped":0,"errors":0,"txErrors":0,"rxErrors":0,"rate":1063473,"txRate":37551,"rxRate":1025922,"bytes":0,"txBytes":8764077315,"rxBytes":414045802743,"packets":0,"txPackets":124114257,"rxPackets":319678738,"pps":176,"txPPS":66,"rxPPS":110,"txJumbo":0,"rxJumbo":0,"rxFlowCtrl":0,"txBroadcast":1742749,"rxBroadcast":36036,"txMulticast":246225,"rxMulticast":59498}},{"id":"0\/4","name":"Camera-Back","statistics":{"dropped":0,"txDropped":0,"rxDropped":0,"errors":0,"txErrors":0,"rxErrors":0,"rate":3877962,"txRate":94828,"rxRate":3783134,...
|
||||
```
|
||||
|
||||
{"statusCode":404,"error":6,"detail":"Entity '\/neighbors' is not supported","message":"Request is not supported"}
|
||||
|
||||
## Neighbors
|
||||
|
||||
**GET /api/v1.0/tools/discovery/neighbors**
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
[{"mac":"00:11:22:33:44:55","age":10,"protocol":"UBNT","fw":"SW.ar7240.v2.2.1.165.240717.1112","model":"TSW-PoE PRO","product":"EdgeSwitch 8XP","hostname":"Switch-01","uptime":1789897,"configured":true,"ip":"fe80::822a:a8ff:fedf:97ca","zoneID":"eth0.4086","addresses":[{"mac":"00:11:22:33:44:55","ip":"192.168.1.10"}]}]
|
||||
```
|
||||
Reference in New Issue
Block a user