This topic is now archived and is closed to further replies.


Using cURL to send web api commands

Recommended Posts

G'day all,


I'm having some difficulty getting the web api commands working correctly. I'm using cURL on my linux box and trying the following commands:

curl -u username:password http://localhost:8080/gui/token.html

This produces and output of

<html><div id='token' style='display:none;'>tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA</div></html>

Now that appears to work fine, so I then send the next command:

curl -u username:password http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA&action=setsetting&s=bind_port&v=10001'>http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA&action=setsetting&s=bind_port&v=10001

results in...

[1] 22209[2] 22210[3] 22211[admin@arch-ut ~]$invalid request[1]   Done                    curl -u username:passwod http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA[2]-'>http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA[2]-  Done                    action=setsetting[3]+  Done                    s=bind_port[admin@arch-ut ~]$

I'm not really sure how to translate this result - because it doesn't seem to make any changes.




I even tried:

curl -u username:password http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA&list=1'>http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA&list=1

which results in:

[1] 22220[admin@arch-ut ~]$invalid request[1]+  Done                    curl -u username:password http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA

Am I sending the incorrect information? This is really bugging me as i'm trying to automate a script to change the bind_port every hour.


Any help would be greatly appreciated.

Share this post

Link to post
Share on other sites

Sorry for the late response, you probably have figured it for now.


In case you didn't, or if anyone get the same problem, it's easy to fix: just put quotes around the URL, like:


curl -u username:password "http://localhost:8080/gui/?token=tpWpgWpgbXhSyTrCmTYX39utU4DcbLdnAAAAAMXBcJoAAAAAxi0BGp0tfVUAAAAA&action=setsetting&s=bind_port&v=10001"


The problem happens because the URL contains &.

Share this post

Link to post
Share on other sites