Web API Controls

General support for problems installing or using Deluge
raspdealer
Leecher
Leecher
Posts: 50
Joined: Sun Oct 04, 2015 6:11 pm
OS or Distro: Raspbian

Web API Controls

Postby raspdealer » Wed Jun 28, 2017 7:46 pm

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: 3463
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Web API Controls

Postby Cas » Wed Jun 28, 2017 8:48 pm

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: 50
Joined: Sun Oct 04, 2015 6:11 pm
OS or Distro: Raspbian

Re: Web API Controls

Postby raspdealer » Fri Jun 30, 2017 7:38 pm

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: 3463
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Web API Controls

Postby Cas » Fri Jun 30, 2017 9:46 pm

You have included an unneeded empty dict in params

raspdealer
Leecher
Leecher
Posts: 50
Joined: Sun Oct 04, 2015 6:11 pm
OS or Distro: Raspbian

Re: Web API Controls

Postby raspdealer » Sat Jul 01, 2017 12:42 pm

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: 3463
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Web API Controls

Postby Cas » Sat Jul 01, 2017 7:04 pm

You have taken away the list too! It's a params list containing a torrents list

raspdealer
Leecher
Leecher
Posts: 50
Joined: Sun Oct 04, 2015 6:11 pm
OS or Distro: Raspbian

Re: Web API Controls

Postby raspdealer » Sun Jul 02, 2017 2:38 pm

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

Thanks!


Return to “Support”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests