Page 1 of 1

add by fileupload API issue

Posted: January 13th, 2013, 8:22 pm
by Mazra
I have a feeling I'm just missing something but every way I've tried to add an NZB file via the API fileupload hasn't worked. Every time I'm getting the error "Expect one parameter". I've tried specifying just name, just nzbfile, and both of them via both GET and POST requests and no matter what I'm still getting the same error message.

I'm using sab version 0.7.6 on FreeBSD 9.1. Any help with this issue would be appreciated.

Re: add by fileupload API issue

Posted: January 14th, 2013, 1:03 pm
by shypike
I use the curl tool to test this functionality:

curl http://localhost:8080/sabnzbd/api -F apikey=MYAPIKEY -F mode=addfile -F output=json -F "name=@d:\path\NAME.nzb" -F "cat=tv"

Re: add by fileupload API issue

Posted: January 14th, 2013, 1:10 pm
by Mazra
So in that command above, is it adding the contents of the nzb in the POST request or just the filename? In my code should I read the NZB in and then add that as part of the POST?

Re: add by fileupload API issue

Posted: January 14th, 2013, 1:28 pm
by shypike
This is what the verbose output of curl says:

Code: Select all

* timeout on name lookup is not supported
* About to connect() to localhost port 8085 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /sabnzbd/api HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost:8080
> Accept: */*
> Content-Length: 106143
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------daedd697013b
>
< HTTP/1.1 100
< Content-Length: 0
< Content-Type: text/plain
< HTTP/1.1 200 OK
< Date: Mon, 14 Jan 2013 18:26:42 GMT
< Content-Length: 3
< Content-Type: text/plain;charset=utf-8
< Pragma: no-cache
< Server: CherryPy/3.2.0
<
So it looks like it uses a POST.