Closed adregner closed 4 years ago
I wanted to use this to pull the basic info about networks from my controller, and got the API path by snooping on network requests in my browser when loading the “Networks” pane of the settings screen.
ADR-ego:~/dev/sources/unifi/examples$ go run main.go 2020/09/08 00:20:33 Requesting https://10.10.0.5:8443/ to determine API paths 2020/09/08 00:20:33 Requesting https://10.10.0.5:8443/api/login, with params: true, cookies: 0 2020/09/08 00:20:34 Requested https://10.10.0.5:8443/api/login: elapsed 857ms, returned 41 bytes 2020/09/08 00:20:34 Requesting https://10.10.0.5:8443/status, with params: false, cookies: 2 2020/09/08 00:20:34 Requested https://10.10.0.5:8443/status: elapsed 5ms, returned 135 bytes 2020/09/08 00:20:34 Requesting https://10.10.0.5:8443/api/stat/sites, with params: false, cookies: 2 2020/09/08 00:20:34 Requested https://10.10.0.5:8443/api/stat/sites: elapsed 41ms, returned 864 bytes 2020/09/08 00:20:34 Found 1 site(s): default 2020/09/08 00:20:34 1 Unifi Sites Found: [0xc00011c8f0] 2020/09/08 00:20:34 Requesting https://10.10.0.5:8443/api/s/default/rest/networkconf, with params: false, cookies: 2 2020/09/08 00:20:34 Requested https://10.10.0.5:8443/api/s/default/rest/networkconf: elapsed 88ms, returned 1796 bytes 2020/09/08 00:20:34 Unifi networks: []unifi.Network{unifi.Network{DhcpdDNSEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdGatewayEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdIP1:"10.10.0.1", DhcpdLeasetime:unifi.FlexInt{Val:86400, Txt:"86400"}, DhcpRelayEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdTimeOffsetEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpGuardEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DomainName:"", Enabled:unifi.FlexBool{Val:true, Txt:"true"}, ID:"56c5403503c8ded5141d12c7", IPSubnet:"192.168.1.1/24", IsNat:unifi.FlexBool{Val:true, Txt:"true"}, Name:"LAN", Networkgroup:"LAN", Purpose:"corporate", SiteID:"56c5403303c8ded5141d12c2", Vlan:unifi.FlexInt{Val:0, Txt:""}, VlanEnabled:unifi.FlexBool{Val:false, Txt:"false"}}, unifi.Network{DhcpdDNSEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdGatewayEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdIP1:"10.10.0.1", DhcpdLeasetime:unifi.FlexInt{Val:86400, Txt:"86400"}, DhcpRelayEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpdTimeOffsetEnabled:unifi.FlexBool{Val:false, Txt:"false"}, DhcpGuardEnabled:unifi.FlexBool{Val:true, Txt:"true"}, DomainName:"adr.local", Enabled:unifi.FlexBool{Val:true, Txt:"true"}, ID:"5a4e987c34de20142beaad58", IPSubnet:"10.10.0.1/23", IsNat:unifi.FlexBool{Val:true, Txt:"true"}, Name:"Trusted", Networkgroup:"LAN", Purpose:"corporate", SiteID:"56c5403303c8ded5141d12c2", Vlan:unifi.FlexInt{Val:2, Txt:"2"}, VlanEnabled:unifi.FlexBool{Val:true, Txt:"true"}}}
ooohhhh... You are the first contributor to this repo. I will look this over and give it a test on my equipment.
Thank you for your contribution!
I wanted to use this to pull the basic info about networks from my controller, and got the API path by snooping on network requests in my browser when loading the “Networks” pane of the settings screen.