Page 1 of 1

Adding Nzb From Android

Posted: June 14th, 2012, 4:11 pm
by potman100
Hi

I'm trying to upload a Nzb file to sab via the api from Android.

I've look all around the net and can't find an answer.

Thanks for any help.

Regards

Potman

Re: Help With Categories

Posted: June 14th, 2012, 5:15 pm
by shypike
"via the api"?
You mean you have some Android app?
Did you set it up properly?

Re: Adding Nzb From Android

Posted: June 14th, 2012, 5:22 pm
by potman100
Hi

Yes, I have an android app, that I can download Nzb files to the device, the problem I have is I
need to send the nzb from the app to sab.

I think its a http post request via mode=addfile but Im not sure.

Regards

Potman

Re: Adding Nzb From Android

Posted: June 15th, 2012, 9:51 am
by potman100
Hi shypike

Any ideas on this ?

Sabcontrol on android can do it, I just can't seem to find out how.

The app has over 700,000 Nzbs avaliable, with a couple of thousand being added daily, and they all come direct from
Usenet.

Regards

Potman

Re: Adding Nzb From Android

Posted: June 15th, 2012, 11:17 am
by shypike
I can give you the CURL command to accomplish it.
This should give you an idea how to do it.

Code: Select all

curl http://host:8080/sabnzbd/api -F apikey=APIKEY -F mode=addfile -F output=json -F "name=@d:\path\to\my\file.nzb"

Re: Adding Nzb From Android

Posted: June 15th, 2012, 11:37 am
by potman100
Hi

thanks for the info, not really used curl in the past but will see If I can get if working.

Regards

Potman

Re: Adding Nzb From Android

Posted: June 15th, 2012, 1:39 pm
by shypike
Curl has some options to show what it is actually sending and receiving.

Re: Adding Nzb From Android

Posted: June 15th, 2012, 3:08 pm
by potman100
Hi

I've managed to craft a http post in basic4android, and when I check the sab logs
it matches the log entry's for the same file added by curl.

The curl one works and adds to sab and gives the return code

{"status":true,"nzo_ids":["SABnzbd_nzo_allw_s"]}

but the b4a fails with

{"status":false,"nzo_ids":[]}

Any idea what this error means ?

Regards

potman

Re: Adding Nzb From Android

Posted: June 15th, 2012, 3:56 pm
by shypike
The "b4a" ?

Re: Adding Nzb From Android

Posted: June 15th, 2012, 4:13 pm
by potman100
basic4android application

Re: Help With Categories

Posted: June 15th, 2012, 5:01 pm
by shypike
The error means that no usable nzb file was received.

Re: Adding Nzb From Android

Posted: June 16th, 2012, 5:30 am
by potman100
Hi shypike

Thanks for your help with this, got it working now, the issue was when reading
the nzb for the post request, there was a \r\n being added to the nzb post data,
which was making the nzb data invalid.

Regards

Potman