Page 1 of 1
API call to update filter in rss feed
Posted: March 23rd, 2025, 5:42 am
by e38383
I'm trying to update a specific filter in one of my RSS feeds, but whatever I'm trying it doesn't update the filter. So far I got this:
Code: Select all
/api?output=json&mode=set_config§ion=rss&keyword=rss+feed+name&filter10=%2C%2C%2CS%2CShow+Name+S03E59%2C-100%2C1
It's working if I try to set enable=0, so the basic call is correct. I just can't find out how to set a filter. I tried various combinations for filter10 (with spaces after the ",", None instead of empty fields, …), but I always get the same config back with nothing changed.
The web-interface is using a completely different method:
Code: Select all
index=10&feed=rss+feed+name&enabled=1&new_index=10&filter_type=S&filter_text=Show+Name+S03E59&cat=Default&priority=-100&pp=&script=Default
But that's not working over the API either.
So, how can I change one specific filter via the API?
Re: API call to update filter in rss feed
Posted: March 23rd, 2025, 12:02 pm
by sander
Documentation
https://sabnzbd.org/wiki/configuration/ ... set_config says
RSS feed example: api?mode=set_config§ion=rss&name=FEED_NAME&enable=VALUE_1&pp=VALUE_2
So let's try that:
Code: Select all
curl -s 'http://127.0.0.1:8080/api?output=json&apikey=335ca9bb72554157864aa3c94d8f0aff&mode=set_config§ion=rss&name=FEED_NAME&enable=VALUE_1&pp=VALUE_2'
... which does result in ~/.sabnzbd/sabnzbd.ini :
Code: Select all
[[FEED_NAME]]
name = FEED_NAME
uri = ,
cat = ""
pp = VALUE_2
script = ""
enable = 0
priority = -100
filter0 = "", "", "", A, *, -100, 1
So that does work for me. For you too?
Re: API call to update filter in rss feed
Posted: March 23rd, 2025, 12:23 pm
by sander
Code: Select all
curl 'http://127.0.0.1:8080/api?output=json&apikey=335ca9bb72554157864aa3c94d8f0aff&mode=set_config§ion=rss&name=GORDON2&uri=https://nzbindex.nl/search/rss?q=gordon'
results in
Code: Select all
[[GORDON2]]
name = GORDON2
uri = https://nzbindex.nl/search/rss?q=gordon,
cat = ""
pp = ""
script = ""
enable = 0
priority = -100
filter0 = "", "", "", A, *, -100, 1
Re: API call to update filter in rss feed
Posted: March 23rd, 2025, 12:31 pm
by e38383
sander wrote: ↑March 23rd, 2025, 12:02 pm
RSS feed example: api?mode=set_config§ion=rss&name=FEED_NAME&enable=VALUE_1&pp=VALUE_2
…
So that does work for me. For you too?
Yes, I can set enable and other top-level keys. But I need to edit a filter.
Re: API call to update filter in rss feed
Posted: March 23rd, 2025, 3:40 pm
by sander
Ah, yes, I now understand your question now.
... and I tried a few things but couldn't the the correct input for filter either. Sorry.
Re: API call to update filter in rss feed
Posted: March 23rd, 2025, 4:04 pm
by sander
FWIW: those None and empties: the format is like this
filter0 = tv, 3, bla.sh, A, dit, 1, 1
filter1 = "", "", "", A, heracles, -100, 1
filter2 = None, "", None, R, *, None, 1
So with my guess from the GUI:
Category
Processing
Script
Accept / Reject / etc
Search term
Priority
Enabled/Disabled
So are you able to fill out "filter0 = tv, 3, bla.sh, A, dit, 1, 1" ... so without None / empty?
Re: API call to update filter in rss feed
Posted: March 23rd, 2025, 4:34 pm
by safihre
Seems there's magic in the code here that we should document.
https://github.com/sabnzbd/sabnzbd/blob ... i.py#L1226
So need to supply filter_action=update and then supply the index= parameter to indicate which filter you want to change
https://github.com/sabnzbd/sabnzbd/blob ... e.py#L1405
Re: API call to update filter in rss feed
Posted: March 24th, 2025, 1:51 am
by e38383
safihre wrote: ↑March 23rd, 2025, 4:34 pm
Seems there's magic in the code here that we should document.
Thank you, that helped a lot. The correct api call is:
Code: Select all
api?output=json&mode=set_config§ion=rss&keyword=Feed+Name&filter_action=update&index=10&filter_type=S&filter_text=Show+Name+S03E60&cat=&priority=-100&pp=&script=&enabled=1
cat/script/pp can also be set to "Default".
Re: API call to update filter in rss feed
Posted: March 24th, 2025, 2:25 am
by sander
Cool!
Full command:
Code: Select all
$ curl 'http://127.0.0.1:8080/api?output=json&apikey=3aa5b2faa7874d75a7fd3059f351d595&mode=set_config§ion=rss&keyword=nzbindexnieuws&filter_action=update&index=1&filter_type=A&filter_text=Jannes&cat=&priority=-100&pp=&script=&enabled=1'
output:
Code: Select all
{"config":{"rss":[{"name":"nzbindexnieuws","uri":["https:\/\/nzbindex.nl\/search\/rss?q=nieuws&max=250"],"cat":"","pp":"","script":"","enable":1,"priority":-100,"filter0":["","","None","A","dit","-100","1"],"filter1":["","","","A","Jannes","-100","1"],"filter2":["None","","None","R","*","None","1"]}]}}
... in pretty print (with "| python3 -m json.tool")
Code: Select all
{
"config": {
"rss": [
{
"name": "nzbindexnieuws",
"uri": [
"https://nzbindex.nl/search/rss?q=nieuws&max=250"
],
"cat": "",
"pp": "",
"script": "",
"enable": 1,
"priority": -100,
"filter0": [
"",
"",
"None",
"A",
"dit",
"-100",
"1"
],
"filter1": [
"",
"",
"",
"A",
"Jannes",
"-100",
"1"
],
"filter2": [
"None",
"",
"None",
"R",
"*",
"None",
"1"
]
}
]
}
}
Re: API call to update filter in rss feed
Posted: March 24th, 2025, 10:42 am
by sander
Maybe handy for testing: different CLI curl format using -F parameters
Input:
Code: Select all
$ curl http://localhost:8080/api -F apikey=3aa5b2faa7874d75a7fd3059f351d595 -F output=json -F mode=set_config -F section=rss -F keyword=nzbindexnieuws -F filter_action=update -F index=1 -F filter_type=A -F filter_text=PietJan -F cat='' -F priority=-100 -F pp='' -F script='' -F enabled=1
Result:
Code: Select all
{"config":{"rss":[{"name":"nzbindexnieuws","uri":["https:\/\/nzbindex.nl\/search\/rss?q=nieuws&max=250"],"cat":"","pp":"","script":"","enable":1,"priority":-100,"filter0":["","","None","A","dit","-100","1"],"filter1":["","","","A","PietJan","-100","1"],"filter2":["None","","None","R","*","None","1"]}]}}
From curl manpage:
Code: Select all
-F, --form <name=content>
(HTTP SMTP IMAP) For HTTP protocol family, this lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using
the Content-Type multipart/form-data according to RFC 2388.