changing save path via API?

Other platforms, generic questions.
Post Reply
bobbintb

changing save path via API?

Post by bobbintb »

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

Re: changing save path via API?

Post by bobbintb »

Is there no way to do this? Right now my other option is saving the torrent, delete, and re-add.
basecase

Re: changing save path via API?

Post by basecase »

This is what I use in my post download scripts.

Code: Select all

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 all

curl http://localhost:8080/api/v2/torrents/setLocation --data "hashes=$QBT_INFOHASH" --data-urlencode "location=$NEW_DIR"
Post Reply