add by fileupload API issue

Get help with all aspects of SABnzbd
Forum rules
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.
Post Reply
Mazra
Newbie
Newbie
Posts: 2
Joined: July 23rd, 2012, 9:03 pm

add by fileupload API issue

Post 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.
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: add by fileupload API issue

Post 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"
Mazra
Newbie
Newbie
Posts: 2
Joined: July 23rd, 2012, 9:03 pm

Re: add by fileupload API issue

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: add by fileupload API issue

Post 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.
Post Reply