API Access and listening port

Other platforms, generic questions.
Post Reply
doctoralex
Member
Member
Posts: 21
Joined: Sun Apr 12, 2015 12:57 pm

API Access and listening port

Post by doctoralex » Tue Nov 12, 2019 2:43 pm

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).

User avatar
Peter
Administrator
Administrator
Posts: 1818
Joined: Wed Jul 07, 2010 6:14 pm

Re: API Access and listening port

Post by Peter » Tue Nov 12, 2019 6:38 pm

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?

SeaMonkey
Newbie
Newbie
Posts: 1
Joined: Sat May 23, 2020 11:17 pm

Re: API Access and listening port

Post by SeaMonkey » Sat May 23, 2020 11:25 pm

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.

SeaMonkey
Newbie
Newbie
Posts: 1
Joined: Sat May 23, 2020 11:17 pm

Re: API Access and listening port

Post by SeaMonkey » Sun May 31, 2020 5:12 am

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"
Last edited by SeaMonkey on Sun May 31, 2020 5:13 am, edited 1 time in total.

Post Reply