Webui add torrent from .torrent file
Webui add torrent from .torrent file
So, using the webui I can add torrents just fine when i use a magnetlink url but I cannot seem to add one using a file. In the api documentation the binary_data_goes_here part throws me off. Does anybody have and example line for me?
Re: Webui add torrent from .torrent file
Just a little additional information. This line seems to be getting through to the server but I'm getting a strange error from the client.
This command gives me this error when qbittorrent is opened in the terminal.
This leads me to believe qBittorrent doesn't recognize the binary format the api says it requires. I get the same error when I use --data-binary, --data, and switch out torrents for filename. I am not sure what the correct way to form the curl command, so I don't think it is a bug. We will see.
Code: Select all
curl --header 'Content-Type: application/x-bittorrent' --data "torrents=41de2d6b93d8edc56a5145d2fe4723647c5dafb1.torrent" http://localhost:8080/api/v2/torrents/add
Code: Select all
bool Http::RequestParser::parsePostMessage(const QByteArray&) unknown content type: "application/x-bittorrent"
Http::RequestParser::ParseResult Http::RequestParser::doParse(const QByteArray&) message body parsing error
Re: Webui add torrent from .torrent file
UPDATE: For those in the same boat as me with the webui api, I figured out the way to use curl for the webui. To add a torrent with the webui, you have to use the --form content type instead of the --data type that you use with the magnetlink add. Here is an example of what worked for me.
So just use --form and an @ in front of the torrent file name.
Code: Select all
curl -X POST --form "savepath=$currentDIR" --form root_folder=false --form "torrents=@$torrentFileName" http://$QBT_HOST:$QBT_PORT/api/v2/torrents/add