API Access and listening port

Other platforms, generic questions.
Post Reply
doctoralex

API Access and listening port

Post 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).
User avatar
Peter
Administrator
Administrator
Posts: 2690
Joined: Wed Jul 07, 2010 6:14 pm

Re: API Access and listening port

Post 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?
SeaMonkey

Re: API Access and listening port

Post 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.
SeaMonkey

Re: API Access and listening port

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