Hi Gang,
I need a little assistance. I am creating a custom web page, from where I would like to be able to change the options for Post processing in my queue to +Repair/Unpack/Delete.
According to the api gui the following should be the right command:
http://myIP:88/api?mode=change_opts&val ... yz&value2=3&apikey=xxxxxxxxxxxxx
After I click on this link, I get an OK return message but the first/only item in my queue still shows it as "Download" and not "+D". I have tried changing the "3" value to 0, 1, 2, and it still does not change it.
Can anyone please shed any light on this? Do I need to specify something else? Any advice is greatly appreciated.
Many thanks,
Hernando
ps. I am running Sab v.0.7.20 on an unRAID server.
A Little API Help - change_opts
Forum rules
Help us help you:
Help us help you:
- Are you using the latest stable version of SABnzbd? Downloads page.
- Tell us what system you run SABnzbd on.
- Adhere to the forum rules.
- Do you experience problems during downloading?
Check your connection in Status and Interface settings window.
Use Test Server in Config > Servers.
We will probably ask you to do a test using only basic settings. - Do you experience problems during repair or unpacking?
Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Re: A Little API Help - change_opts
Pity you altered your URL, because now I have to ask: did you fill out the real at "value=SABnzbd_nzo_zt"? Because you have to.
Hint:
That works; Processing is changed in the queue.
Remark:
A nonsense NZO lead to "ok" to:
... that "ok" is strange, and maybe even a bug
Hint:
Code: Select all
$ lynx --dump 'http://localhost:8080/api?mode=qstatus&output=xml' | grep '<id>'
<id>SABnzbd_nzo_zf8FEN</id>
<id>SABnzbd_nzo_m1oBuz</id>
$ lynx --dump 'http://localhost:8080/api?mode=change_opts&value=SABnzbd_nzo_zf8FEN&value2=1'
ok
Remark:
A nonsense NZO lead to "ok" to:
Code: Select all
$ lynx --dump 'http://localhost:8080/api?mode=change_opts&value=SABnzbd_nzo_NONSENSE&value2=1'
ok
Re: A Little API Help - change_opts
It works when I test it.
Code: Select all
curl http://127.0.0.1:8085/sabnzbd/api -F apikey=XXX -F mode=change_opts -F output=json -F value2=3 -F value=SABnzbd_nzo_YYYYYY
Re: A Little API Help - change_opts
Works in which way? I don't see the result of your API callshypike wrote:It works when I test it.
Code: Select all
curl http://127.0.0.1:8085/sabnzbd/api -F apikey=XXX -F mode=change_opts -F output=json -F value2=3 -F value=SABnzbd_nzo_YYYYYY
In both cases I get {"status":true}
Code: Select all
sander@flappie:~$ lynx --dump 'http://localhost:8080/api?mode=qstatus&output=xml' | grep '<id>'
<id>SABnzbd_nzo_5dNJ6A</id>
<id>SABnzbd_nzo_DHXQWJ</id>
sander@flappie:~$ curl http://127.0.0.1:8080/sabnzbd/api -F mode=change_opts -F output=json -F value2=3 -F value=SABnzbd_nzo_YYYYYY
{"status":true}
sander@flappie:~$ curl http://127.0.0.1:8080/sabnzbd/api -F mode=change_opts -F output=json -F value2=3 -F value=SABnzbd_nzo_5dNJ6A
{"status":true}
Re: A Little API Help - change_opts
I see the post-processing option change in the web interface.
Is the OP sure that the web interface automatically refreshes?
Is the OP sure that the web interface automatically refreshes?
Re: A Little API Help - change_opts
Me too. But no useful result in the API call. Could be by design, but a bit confusing / misleading, IMHO.shypike wrote:I see the post-processing option change in the web interface.
My first check is to verify the OP is using the actual NZO codes at all ...shypike wrote: Is the OP sure that the web interface automatically refreshes?
-
- Newbie
- Posts: 5
- Joined: January 6th, 2015, 12:25 pm
Re: A Little API Help - change_opts
Thank you guys... I was pasting directly from the API help page.... and now realize that the value SABnzbd_nzo_zt2syz needs to be unique to my queue...
I typed this in my URL and
In the resulting code, I saw that there is a unique value to my current queue.
I need to parse that item out and then use it as the value in my original post. That worked... I need to figuure what some of you guys posted about curl... I tihnk they are methods to extract this info... I am not an expert, but I will figure it out. My goal is to change any and all items in my queue to +Repair/Unpack/Delete.
Many thanks again!!!
H.
I typed this in my URL and
Code: Select all
http://myIP:88/api?mode=queue&start=START&limit=LIMIT&output=json&apikey=xxxxx
Code: Select all
"nzo_id":"SABnzbd_nzo_xwTFWx"
Many thanks again!!!
H.
-
- Newbie
- Posts: 13
- Joined: May 22nd, 2013, 6:00 pm
Re: A Little API Help - change_opts
I managed to figure out a script that sets this automatically to all items in the queue... Thanks to all the guys above me for their guidance.
Hopefully this will help someone.
Thanks again,
H.
Code: Select all
<?php
$response = file_get_contents("http://YOUR-IP-OR-URL:88/api?mode=qstatus&output=json&apikey=YOUR-API-KEY");
$json = json_decode($response, true);
$runningcount = 0;
foreach($json['jobs'] as $item) {
$itemcode = $item['id'];
$reseturl = "http://YOUR-IP-OR-URL:88/api?mode=change_opts&value={$hritemcode}&value2=3&apikey=YOUR-API-KEY";
$resetresponse = file_get_contents($reseturl);
$runningcount = $runningcount + 1;
}
echo "Changed {$runningcount} items in the queue.";
?>
Thanks again,
H.