Web API Controls

General support for problems installing or using Deluge
Post Reply
raspdealer
Leecher
Leecher
Posts: 56
Joined: Sun Oct 04, 2015 6:11 pm

Web API Controls

Post by raspdealer »

Hi,

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

Thanks
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Web API Controls

Post 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.
raspdealer
Leecher
Leecher
Posts: 56
Joined: Sun Oct 04, 2015 6:11 pm

Re: Web API Controls

Post 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?
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Web API Controls

Post by Cas »

You have included an unneeded empty dict in params
raspdealer
Leecher
Leecher
Posts: 56
Joined: Sun Oct 04, 2015 6:11 pm

Re: Web API Controls

Post 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

Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Web API Controls

Post by Cas »

You have taken away the list too! It's a params list containing a torrents list
raspdealer
Leecher
Leecher
Posts: 56
Joined: Sun Oct 04, 2015 6:11 pm

Re: Web API Controls

Post by raspdealer »

Ok got it!
Is there a method to refresh all torrents trackers also?

Thanks!
Post Reply