Just a reminder that London GNOME Beer (v2.2) will be happening this Friday. Add your name to the wiki here.
When OpenedHand was first acquired by Intel I was asked to look into ways of making it easier to access web services from within GLIBish (i.e. Clutter & GTK) applications. We figured that as web services more important to the users of Moblin, and thus by extension, GNOME we needed some way to help developers access them.
So, I did some research, read up on RESTful. And thought yay, lots of services are claiming to be RESTful, let’s see if we can come up with some kind of service description language that we can autogenerate code from (ala, dbus-glib). Turns out that very few services actually adhere to this RESTful definition and my attempts to produce some kind of description language resulted in more lines of XML than code, hmmm.
Anyway, I persevered and looked at building an API that I would fine easy to drive RESTful web services with. After a few iterations I decided upon designing something with a somewhat Cairo-esque API.
Marco thinking RESTful thoughts.
The API is comprised of two parts, the first half is for making the requests (and is based on libsoup.) Here is an example:
proxy = rest_proxy_new ("http://www.flickr.com/services/rest/", FALSE); call = rest_proxy_new_call (proxy); rest_proxy_call_add_params (call, "method", "flickr.test.echo", "api_key", "
", "format", "xml", NULL); rest_proxy_call_run (call, NULL, NULL); /* obviously can do async instead */ payload = rest_proxy_call_get_payload (call); len = rest_proxy_call_get_payload_length (call);
Easy, huh? Anyway, enough rambling for today’s blog post, next week i’ll talk about the really interesting stuff we’re (Ross and I) are working on to make parsing XML fun (yes, really, honestly, fun.)
Oh and and the source code can be found in git and it’s licensed under LGPLv2.1, etc etc. (Yes, we have too many libraries, when mature perhaps we can move this into libsoup.)