Hi guys,
I have a question around controlling a WISP switch remotely without using an interactive method like the WebUI or CLI manually.
Ideally I'd like to know if a (Token secured) API can be used to make configuration changes, rather than just polling for statuses.
Alternatively, if something like snmpset could be used, that would also be useful.
The settings I specifically want to change are POE states on individual ports, although some other settings would also be useful.
Thanks in advance,
Stefan
Remote Managing WISP Switch
-
spynappels - Member
- Posts: 15
- Joined: Wed Oct 14, 2015 5:37 am
- Location: United Kingdom
- Has thanked: 3 times
- Been thanked: 0 time
-
Eric Stern - Employee
- Posts: 532
- Joined: Wed Apr 09, 2014 9:41 pm
- Location: Toronto, Ontario
- Has thanked: 0 time
- Been thanked: 130 times
Re: Remote Managing WISP Switch
Most people just script the CLI over SSH. But you could also use the REST API to read/write the configuration if you wanted.
There is some information on how to use the REST API here: viewtopic.php?f=6&t=2216&p=15793
Once you get the session cookie you will want to GET /api/v1/config to obtain the configuration in JSON format. Modify the configuration as needed and then POST to /api/v1/config to save the new config on the switch and then POST (with an empty body) to /api/v1/apply to apply the new configuration.
There is some information on how to use the REST API here: viewtopic.php?f=6&t=2216&p=15793
Once you get the session cookie you will want to GET /api/v1/config to obtain the configuration in JSON format. Modify the configuration as needed and then POST to /api/v1/config to save the new config on the switch and then POST (with an empty body) to /api/v1/apply to apply the new configuration.
-
spynappels - Member
- Posts: 15
- Joined: Wed Oct 14, 2015 5:37 am
- Location: United Kingdom
- Has thanked: 3 times
- Been thanked: 0 time
Re: Remote Managing WISP Switch
Thanks for that Eric, I'll have to have a play with that and see what I can work out.
-
spynappels - Member
- Posts: 15
- Joined: Wed Oct 14, 2015 5:37 am
- Location: United Kingdom
- Has thanked: 3 times
- Been thanked: 0 time
Re: Remote Managing WISP Switch
Thanks for your help so far Eric. I have now got the calls to login and get a PHPSESSID and can successfully query the API.
I'm using Python with the requests module and so far I've been able to do everything I needed to (eventually) except for saving a whole config back to the switch. I keep getting version mismatch 409 response codes, which I've found in the api.php and config.php files and which I'm now working out.
What I'm not 100% clear on from my reading of these 2 files is whether there may be a (supported) way to only change 1 setting using the POST config method. As far as I can tell there isn't, but in config.php I do see how the config.json is being built and populated and I think it may be possible to hack something together there, but I know that won't be supported, and I was hoping there might be an undocumented but supported way of doing the same thing.
Oh, and if you are looking to add to a wishlist, Token based auth for the API and documentation would be awesome. (as well as being able to edit individual settings by making API calls......)
I'm using Python with the requests module and so far I've been able to do everything I needed to (eventually) except for saving a whole config back to the switch. I keep getting version mismatch 409 response codes, which I've found in the api.php and config.php files and which I'm now working out.
What I'm not 100% clear on from my reading of these 2 files is whether there may be a (supported) way to only change 1 setting using the POST config method. As far as I can tell there isn't, but in config.php I do see how the config.json is being built and populated and I think it may be possible to hack something together there, but I know that won't be supported, and I was hoping there might be an undocumented but supported way of doing the same thing.
Oh, and if you are looking to add to a wishlist, Token based auth for the API and documentation would be awesome. (as well as being able to edit individual settings by making API calls......)
4 posts
Page 1 of 1
Who is online
Users browsing this forum: No registered users and 84 guests