API upload nzb file

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
Timmeeeeh
Newbie
Newbie
Posts: 1
Joined: November 15th, 2014, 9:17 pm

API upload nzb file

Post 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
User avatar
sander
Release Testers
Release Testers
Posts: 9429
Joined: January 22nd, 2008, 2:22 pm

Re: API upload nzb file

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