Colin Bonstead
TVWBB Member
I'm looking into adding admin support to my app. I read through the urls and commands page on the wiki and tried to figure out a command string for changing the setpoint. It seems like it should be something like this:
http://server/luci/lm/set?sp=250
That just gives me an error message though. I went to the normal webpage and clicked the login link and typed in my password. After that was done I was at a page like this:
http://server/luci/;stok=biglongtoken/admin/lm/home/
I tried just changing that url to be the one I tried before, but with the token in there. So, something like this:
http://server/luci/;stok=biglongtoken/admin/lm/set?sp=250
I had to add the /admin/ part too, but that makes sense since I'm doing something that should be admin only. It worked though, my setpoint was changed. My question is, is this the correct way to do this? The only part that seems a little problematic is the login. I'm used to standard HTTP auth, where when you request a protected url you supply the login and password as parameters to the url request (I'm talking about doing this from code, not a browser.) Is there a way to login to the HeaterMeter with just a url, and not having to actually parse the login webpage? Also, am I expected to store the token and make it part of the url? That's not really a big deal, as long as I login and get it without having to do any scraping or something like that.
http://server/luci/lm/set?sp=250
That just gives me an error message though. I went to the normal webpage and clicked the login link and typed in my password. After that was done I was at a page like this:
http://server/luci/;stok=biglongtoken/admin/lm/home/
I tried just changing that url to be the one I tried before, but with the token in there. So, something like this:
http://server/luci/;stok=biglongtoken/admin/lm/set?sp=250
I had to add the /admin/ part too, but that makes sense since I'm doing something that should be admin only. It worked though, my setpoint was changed. My question is, is this the correct way to do this? The only part that seems a little problematic is the login. I'm used to standard HTTP auth, where when you request a protected url you supply the login and password as parameters to the url request (I'm talking about doing this from code, not a browser.) Is there a way to login to the HeaterMeter with just a url, and not having to actually parse the login webpage? Also, am I expected to store the token and make it part of the url? That's not really a big deal, as long as I login and get it without having to do any scraping or something like that.