Page 1 of 1

API Access and listening port

Posted: Tue Nov 12, 2019 2:43 pm
by doctoralex
Hi,

Does anyone has successfully worked with the API and more specifically able to change the listening port?

I tried couple of times and I was able to find the setting but not able to change the value (in the wiki says that it will report 200 in anycase).

Re: API Access and listening port

Posted: Tue Nov 12, 2019 6:38 pm
by Peter
I mean unless you are writing an app, can't you just write a script that kills process, does a replace for port in config file and start the daemon again?

Re: API Access and listening port

Posted: Sat May 23, 2020 11:25 pm
by SeaMonkey
I'm trying to do this as well, but

Code: Select all

curl -i --header 'Referer: https://earth.thegalaxy:8081' --data 'username=seamonkey&password=xxxxxxxxxxxxxxxxxxx' https://earth.thegalaxy:8081/login
returns

Code: Select all

HTTP/1.1 404 Not Found
connection: keep-alive
content-length: 0
content-security-policy: default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self' 'unsafe-inline'; object-src 'none'; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests;
date: Sat, 23 May 2020 22:47:32 GMT
referrer-policy: same-origin
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
WebUI is accessible from https://earth.thegalaxy:8081.

Re: API Access and listening port

Posted: Sun May 31, 2020 5:12 am
by SeaMonkey
I realized I was looking at outdated API documentation. Here's the working portion of my script for anyone who needs it.

Code: Select all

# Update qBittorrent
SID=`curl -i --header 'Referer: https://earth.thegalaxy:8081' --data 'username=seamonkey&password=xxxxxxxxxxxxxxxxxxx' https://earth.thegalaxy:8081/api/v2/auth/login | grep SID | awk '{ print $2 }' | sed 's/;//'`
echo $SID
curl https://earth.thegalaxy:8081/api/v2/app/setPreferences --cookie "$SID" -d "json=%7B%22listen_port%22%3A${PORTNUM}%7D"