Author Topic: changing save path via API?  (Read 873 times)

bobbintb

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
changing save path via API?
« on: March 31, 2017, 04:29:26 am »
I have qbittorrent running in a docker on my server. The webui is lacking a lot of options compared to the desktop client. I need to change the save path of a torrent once it has been been completed. Can I do this with an API call? I looked at the documentation and did not see a way to go this but thought I'd ask in case I overlooked something or it is undocumented. I know I can remove the torrent and add it again in a new location within the webui but I need to automate it.

bobbintb

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: changing save path via API?
« Reply #1 on: April 04, 2017, 05:03:19 pm »
Is there no way to do this? Right now my other option is saving the torrent, delete, and re-add.

basecase

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: changing save path via API?
« Reply #2 on: September 08, 2019, 03:46:43 pm »
This is what I use in my post download scripts.

Code: [Select]
cookie_hash=$((curl -i --header "Referer: http://$QBT_HOST_IP:$QBT_HOST_PORT" --data-urlencode "username=$QBT_USERNAME" --data-urlencode "password=$QBT_PASSWORD" http://$QBT_HOST_IP:$QBT_HOST_PORT/api/v2/auth/login | grep "set-cookie:" | cut -d';' -f1 | cut -d':' -f2) 2>&1) 
cookie_hash=${cookie_hash##* }
curl http://$QBT_HOST_IP:$QBT_HOST_PORT/api/v2/torrents/setLocation --cookie "$cookie_hash" --data "hashes=$QBT_INFOHASH" --data-urlencode "location=$NEW_DIR"

More generally, if you have authentication turned off for localhost and are using the default port. This would do. $NEW_DIR being the location you want to set as the new location.
Code: [Select]
curl http://localhost:8080/api/v2/torrents/setLocation --data "hashes=$QBT_INFOHASH" --data-urlencode "location=$NEW_DIR"