Page 1 of 1

Web API Controls

Posted: Wed Jun 28, 2017 7:46 pm
by raspdealer
Hi,

I would like to know the best way to stop or resume all torrents?
Is there an instruction?

Thanks

Re: Web API Controls

Posted: Wed Jun 28, 2017 8:48 pm
by Cas
In 1.3 there is core.pause_all_torrents and core.resume_all_torrents. Note this pauses the session rather than the status of individual torrents. If you need the latter then core.pause_torrent or core.resume_torrent with the list of all torrents.

Re: Web API Controls

Posted: Fri Jun 30, 2017 7:38 pm
by raspdealer
Thanks Cas!
I have tested this:

Code: Select all

#!/bin/bash
sudo curl -c cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "auth.login", "params": ["password"], "id": 1}' http://192.168.1.104:8112/json
json=$(sudo curl -b cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "core.pause_torrent", "params": [["32711a056af4df3454302857784f92a7e351b375","33fdcbebc3a58fc9e4f24511667149391d30aaf2"], {}], "id": 1}' http://192.168.1.104:8112/json)
sudo rm cookies.txt
echo $json
But it's loading an endless json response.
Thoughts?

Re: Web API Controls

Posted: Fri Jun 30, 2017 9:46 pm
by Cas
You have included an unneeded empty dict in params

Re: Web API Controls

Posted: Sat Jul 01, 2017 12:42 pm
by raspdealer
Same result with

Code: Select all

#!/bin/bash
sudo curl -c cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "auth.login", "params": ["password"], "id": 1}' http://192.168.1.104:8112/json
json=$(sudo curl -b cookies.txt --compressed -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"method": "core.pause_torrent", "params": ["32711a056af4df3454302857784f92a7e351b375", "315b7ef02d2001c1dd8ac963fb977d8c6ae4941f"], "id": 1}' http://192.168.1.104:8112/json)
sudo rm cookies.txt
echo $json


Re: Web API Controls

Posted: Sat Jul 01, 2017 7:04 pm
by Cas
You have taken away the list too! It's a params list containing a torrents list

Re: Web API Controls

Posted: Sun Jul 02, 2017 2:38 pm
by raspdealer
Ok got it!
Is there a method to refresh all torrents trackers also?

Thanks!