Page 1 of 1

API upload nzb file

Posted: November 15th, 2014, 9:24 pm
by Timmeeeeh
Hi, im integrating SABnzbd into my android app. But I'm having some problems with uploading nzb files with the API.

What i get returned is this: error: expect one parameter

this is my URL in java: "http://" + hostname + ":" + port + "/api?mode=addfile&nzbname=" + FILENAME + "&apikey=" + apiKey
and i set the file itself as a multipart entity as a HTTP POST entity. But as i said i always get error: expect one parameter returned.

Is my URL wrong or am i doing something completly wrong?

Thx

Re: API upload nzb file

Posted: November 16th, 2014, 2:47 am
by sander
Two examples


The bad:

Code: Select all

$ curl http://localhost:8080/sabnzbd/api -F "apikey=b463b755ad289e4fd2e2e7319ab6" -F mode=addfile -F "name=/home/sander/Downloads/XD830dcea0ed04c547.nzb"

error: expect one parameter
The good:

Code: Select all

$ curl http://localhost:8080/sabnzbd/api -F "apikey=b463b755ad289e4fd2e2e7319ab6" -F mode=addfile -F "name=@/home/sander/Downloads/XD830dcea0ed04c547.nzb"

ok
... do you see the difference? Hint: "@" ...

HTH

EDIT:

It's a POST, not a GET.