--- sabnzbd/interface.py 2010-11-15 12:54:48.000000000 -0800
+++ interface.py 2010-12-11 17:31:07.000000000 -0800
@@ -515,7 +515,10 @@
if kwargs.get('mode', '') not in ('version', 'auth'):
msg = check_apikey(kwargs)
if msg: return msg
- return self.api_handler(kwargs)
+ response = self.api_handler(kwargs)
+ if kwargs.get('output') == 'json' and kwargs.get('callback') is not None:
+ response = '%s(%s)' % (kwargs.get('callback'), response)
+ return response
def api_handler(self, kwargs):
It would be great to have this available. Also I found an SVN repository that seems to be really old. Is there a newer repository available? I'd like to mirror it on GitHub.
I should remove that old repository.
The only reason the Assembla site is still active is that it contains
a number of improvement requests that haven't been copied to Launchpad.
http://en.wikipedia.org/wiki/JSON#JSONP - essentially it allows me to talk to the application directly from JS from another domain. Im writing a HTML/JS application to manage my local media center and want to talk to SABnzbd+ directly from my iPhone browser.
Was this feature implemented in 0.6.0? I can't find it in the documentation. If so, how do I specify the callback function in the URL? IS it just http://****:8080/sabnzbd/api/?output=json&callback=[somecallbackfunction]?
Did you guys implement this function in for all API calls? I can't get this to work with i.e. "error: API Key Incorrect".. It will return just normal JSON and not JSONP.
No, i didn't.. That's the idea. I am writing an application in JavaScript and i have a function that checks for a valid api key. But all returns must be in JSONP. But when I give up an unvalid key, it just returns as a string (JSON) and not a callback function (JSONP), which means I can't do anything with the returned data.
PS: I get the same with the api call "http://host:port/sabnzbd/api?mode=auth".. So it seems that SabNZBd doesn't always return JSONP..
shypike wrote:
In that case you'll have to wait for release 0.6.3
Thank you for taking care of this, I really hope this will be fixed in the next release! Do you want me to make a list of api methods who do not work with JSONP, or isn't that necessary?