Saturday, 6 February 2010

Generic web-service queries on your desktop using Plasma

Some days ago, I applied for a new passport. In Munich, where I currently live, you apply for the passport at the city hall and usually can pick the passport up there 3 weeks later. I was surprised to see that they have a new service: You get an ID number with which you can check the status of your passport via a web-service. So, if you check regularly, the web-service will tell you when your
passport is ready to pick it up.

What is the usual you do in cases like that? Of course, you write a Plasmoid that checks the web-service periodically and informs you when your passport is ready. This plasmoid - PersonalKwery - can be seen in screenshot 1.

Thinking further about this quick hack, I came to the conclusion that with only a little bit of work, I could create a generic plasmoid that can query webservices and display the result on your desktop. I managed to create a plasmoid that takes the following configuration:

  • Base URL of the web-service

  • Attributes to the URL (like the ID number of my passport, or arguments to a Google query)

  • An optional XSLT to transform the results

  • An interval, how often the query should be performed

With this little configuration you can easily query many web-services. Of course, most users won't be in the mood to create their own XSLT transformations! Therefore it is possible to store the configurations as XML and share them - for example over "get hot new stuff". In this case, users can
download predefined web-service queries and only have to enter a few necessary attribute values. The screenshot below shows the configuration dialog for a query:

Another small example is a simple query, that get's your current internet IP address.

Of course, the tool is not perfect yet and can be made more user friendly. If you are interested, you can get the tarball here: personalkwery-0.1.tar.gz.


thomaszastrow said...

This is a fantastic idea and exactly what I need ;-)

I'm not an experienced C++ programmer, so I'm not sure what I have to do with the source code? "make" does not do anything and there is no configure script??

Dominik Seichter said...

You can compile the source code using this commands:

tar xvfz personalkwery-0.1.tar.gz
cd personalkwery-0.1
mkdir build
cd build
sudo make install

libxml2 and libxslt are required for compilation.

Mark said...

Hey Dominik, great work! This has a lot of potential. I think could think of usecases for parcel tracking or checking the amount of money on a bank account. Although I would prefer not to have the result presented on the desktop, rather as a plugin into the notification system giving a notification which has to be confirmed.

lingjie shi said...

This is really very useful information that I have come across through searching the keyword best replica watches uk