REST like interface
andreas.sliwka at gmail.com
Wed Oct 10 01:56:49 PDT 2007
2007/10/10, Curtis Maloney <cmaloney at cardgate.net>:
> Andreas Sliwka wrote:
> > Greetings,
> > while writing a small application I decided that I'd like to have REST
> > like set of interfaces published through dbus.
> I'm assuming you mean you want to map your DBus objects to a REST interface on a
> web site? Essentially giving a HTTP RPC front end.
Ah, not quite. I'm writing a small application that will run in the
background, and I'd like to have a set of clients (command line, gui,
systray) that use a simple interface to communicate with that server.
Since DBus is a quick way to build such an architecture I decided to
go that way, but since I dont know yet which parts of the object is to
be used by which client I tried to have a simple interface that
exposes *all* functionality, that's why used the term REST like (and I
know that I got even that wrong, see mail to havoc ...)
> If so, I have done something close to this (using Django, a Python web
> framework) and JSON for the data encoding.
Cool, so you can control a DBus service through your webbrowser? I'd
really like to see that code - if possible ...
> > Consider an application that manages 3 kind of objects, each instance
> > having a unique ID and a set of attributes and and some methods. I'd
> > like to expose each of these instances through an interface, while
> > having a single main interface that has holds some functionality for the
> > service itself.
> > Now my question: Is publishing such a REST interface feasible with dbus?
> Absolutely. It should be obvious how dbus paths can map to URLs. The trick
> comes down to how do you specify the interface/method you wish to invoke.
> (Many thanks to Simon, fallback objects have made this memory efficient :)
And fallbacks are just what I needed, thanks! I spend yesterday
evening trying to find out how to use them (dbus-python's
documentation is a bit sparse for this topic ...), but the test cases
distributed with the code gave me enough rope to, well, you know what
> As I mentioned... I did all of this in Python, and would be glad to help (and
> not just because it helps me, too :)
A second pair of eyes would definetly be appreciated - but at the
moment the code is very much in flux, so I'll first have to tidy it up
a bit before I show it to someone else than /dev/null :-) But be sure
that I'll come up with a lot of questions on the way, and it seems
that I found the right mailing list for that.
Thanks & best regards,,
More information about the dbus