Using the Ubuntu One APIs for Your Apps: An Overview - Instructors: Stuart Langridge

Hi, all! 
I'm Stuart Langridge, from the Ubuntu One team, and I'm here to talk about our app developer
programme.  Do please ask questions throughout the talk: in the #ubuntu-classroom-chat channel,
write QUESTION: here is my question 
We want to make it possible, and easy, for you to add the cloud to your apps and to make new apps
for the cloud This is your personal cloud we're talking about here; your data. Not an enterprise
cloud sort of thing :) 
So we do all the heavy lifting, and your users (and you!) get the benefits.  Imagine, for example,
you've made a recipe manager application. 
So you can type in all the recipes you like to cook, and you've got a permanent record of them.
(For me, that would be: get a pizza base; put pepperoni on it. I reckon you can think of better
recipes than that.) 
(and: actual recipes, for nice food. Not, like, Launchpad recipes. :) Don't really want to take your
laptop into the kitchen, though, of course. 
So, build a mobile app which you sign into with Ubuntu One, and have that show all your recipes too.
And a web app which you sign into with Ubuntu One, so that you can look up recipes while you're at a
friend's house. 
So you've got your stuff, wherever you are, whichever device you're on. Ubuntu, Android, iOS,
Windows, webOS, whichever you want, your data's in your personal cloud and so it's everywhere for
you.  This is the sort of thing that we want to make easy; giving your users and you quick access to
the Ubuntu One technology. 
Mobile access to your data; web app access to your data; saving files direct into Ubuntu One;
publishing files and photos from all your apps; adding playlists to the Ubuntu One music streaming
app; streaming the user's own music into a game you've written.  This stuff is all being heavily
worked on right now as we speak. 
So this talk won't be too detailed with specifics, because they might change.  But I'm more than
happy to answer questions and so on! And I can probably tell you what I think the specifics are, if
they're not already documented at :) 
I want to give you a flavour of what will soon be possible, and answer questions, and give some
pointers, and get your thoughts.  infodroid asked: you didn't mention desktop access to data... this
is the primary use case i am looking at: seamless synchronisation of the user's app on the desktop 
oops :) I didn't deliberately leave it out! 
desktop access to data is absolutely part of this so you can sync a desktop app's data to other
desktops, totally 
and then you get to build web apps or mobile apps or both as well which also share the same data
Also, this is App Developer Week, so I can talk about what the components we're working on are and
then admire all the cool ways you all come up with for snapping them together, rather than waiting
for marketing to come up with a "product" for you to use :) 
So, some components that can be snapped together.  You'll be able to sign in to a web application
with Ubuntu One. 
This means that you don't have to manage your own identity system, think about password renewal, all
that.  This is just like "sign in with Facebook" or "sign in with Twitter"; it's OpenID-based, and
lets your users sign in to a web app and you'll know their Ubuntu identity. 
infodroid asked: I have reviewd the online docs for API Docs > Data > Store data. However it is not
clear what language bindings are available to use.  infodroid, there are lots, depending on what
you're trying to do 
but I know that the developer site doesn't yet talk about bindings I'm working on that :) 
Once you've signed in to an app with Ubuntu One, that app can ask for permission to work with your
data.  This lets you, developers, build applications that work on the desktop, on the web, on mobile
The recipe manager example I mentioned above is one sort of thing you could do, there Your users use
the nice recipe manager app on Ubuntu, which you've built with Quickly or whatever you prefer 
And then they can go to and sign in with Ubuntu One then
asks them for permission to access their "recipes" database 
and can then show them all their recipes on the web!  Your app ( does this via
OAuth; it goes through the standard OAuth dance to get an OAuth token which can be used to access
the user's recipes data 
And your users can be happy that it's secure, because will only have access to
their recipes data; it can't read their contacts or their credit card info.  tomalan asked: Is
Ubuntu One also available on other Linux Desktop Distros, like Fedora? 
Certainly some people have done some work to package Ubuntu One for other distros I think there's an
ITP for Debian 
and we've been pinged on #ubuntuone by people interested in putting Ubuntu One on Fedora and Arch I
don't remember the details, though, so I'm not sure what stage those bits of work are at 
so, I was talking about apps working with your data But you can imagine sharing other sorts of data
between applications. 
Imagine, for example, an achievements system.  You write a few games; some on the web, some on
mobile phones, some on the Ubuntu desktop, some on Windows. 
And every time the user achieves something in a game, you save that achievement to that user's
"achievements" database.  On Ubuntu, you'd save that "trophy" into a file, and Ubuntu One will take
care of synchronising that into the cloud. 
On the web, your game's backend can use the REST API for file access: see On Android or iOS or webOS or Blackberry or Meego
or Windows Phone 7 you can do exactly the same thing; every language has an HTTP access library! 
You could even write your own wrapper library for PHP or Rails or Flash or whatever you prefer (and
then tell me about it so I can point to the documentation for it!) At that point, all your games
save achievements to the same place, so all your games can show you the achievements you've won in
any game 
And, as before, you can set up where a user can log in and see all their
achievements.  kermit66676 asked: So, the methods listed on the API documentation pages are all HTTP
methods for the server? 
I think the API docs list all the public documented committed-to APIs but I'd be interested to hear
if there's something the docs don't cover 
paglia_s asked: i'm realizing an implementation of Ubuntu One apis written in php and i've seen that
apis are quite slow. Do you plan to improve speed?  paglia_s, hiya! 
paglia_s, yes, we're working on that, definitely and we're also interested in how people are using
the APIs 
so that we may be able to add ones which more closely return the information you want 
There's loads of stuff you can do with shared data. 
But Ubuntu One's not just about data. 
Take the music streaming service, for example. 
You can currently stream music to Android and iPhone, and you'll be able to add that music to the
cloud from Ubuntu and Windows.  Maybe you want to be able to stream music back to your Ubuntu
machine without syncing it, or your Mac, or your Palm Pre, or your LG mobile phone, or your toaster. 
So, just use the music streaming API, which is again a simple REST HTTP API, or help people to get
at their music by showing them our HTML5 web player for streaming music.  But there's more
interesting ideas around music streaming than just "listen to the music". 
Playlists, for example. The Ubuntu One Streaming apps on Android and iPhone know how to create
playlists.  But how they do that is not a secret. Your playlists are just stored in your cloud
So, why not sync your playlists from Banshee or Rhythmbox or Amarok or Exaile or Quod Libet or
iTunes or Windows Media Player?  (insert your choice of player here :)) 
Copy the playlists from your media player into desktopcouch on Ubuntu or into the cloud directly
with u1couch on Windows or the Mac or anywhere else, in the correct format, and those playlists will
instantly show up on your phone!  A simple example of this is which is a quick script I wrote to take an m3u
playlist and store it in desktopcouch on Ubuntu. 
So you can make your Banshee playlists available to the Ubuntu One app on your Android phone by
exporting them as m3u and then importing them with the script.  And of course if you sync your
playlists from your media player to Ubuntu One, then you can sync them back from Ubuntu One to your
media player. 
What this means is that if you've got two machines -- let's say, a desktop and a netbook -- then
creating a playlist on your desktop will automatically also make it appear on your netbook.  And
your netbook can either sync all your music that you store in Ubuntu One (if it's got enough space)
or stream that music directly from Ubuntu One without ever syncing it locally. 
Your music, everywhere; but importantly, not just your music but your playlists and scores and
ratings and everything.  If you're interested in bringing this to your music player, let me know and
I can help; ask questions now :-) 
paglia_s asked: do you plan to add support for notes, too? Will this support also images/video...?
paglia_s, I'm not sure what you mean by "support for notes"? 
paglia_s, you already can edit notes synced from tomboy on the website jsjgruber_test asked: ​ I
can't synchronize my desktopcouch database -- because of 503 service unavailable returns, and I hear
that the servers are being worked on for this. Any news about when they will be able to handle the
jsjgruber_test, we're working on that, as you know, but I don't have an answer fo when that work
will be completed kermit66676 asked: yes, have there been any intentions of making an Ubuntu One
gallery viewable online from a Shotwell photo collection? 
kermit66676, interesting idea! If you were thinking of displaying that sort of thing on a website,
the rest files API would be a good starting point we've had a few ideas ourselves in that sort of
area too :) 
so, I was talking about music :) Tighter integration is great, here; what we want to do is to make
it easy for you all to build the stuff that you want on top of Ubuntu One. 
So if you want to have your Amarok playlists available for streaming, it should be possible to do.
I rather like the idea of playing a Flash game on the web and having the background music be the
most appropriate music chosen from *my* music collection. That'd be cool. 
Ubuntu One also, as you know, does file sync.  :-) 
But just syncing files is already taken care of by Ubuntu One itself, on Ubuntu and Windows.  What's
more interesting is working with those files. 
So, for example, imagine being able to instantly, one-click-ly, publish a file from your application
to a public URL and then tweet that URL.  Instant get-this-out-there-ness from your apps. 
The screenshot tool Shutter, for example, can do this already; PrtSc to take a screenshot, then
"Export > Ubuntu One".  They did a bunch of hard work to do that, and I massively applaud them; nice
one Shutter team! 
Based on what they did, that's the sort of thing that should be easier to do.  So there are
easy-to-use APIs so your apps can do the same. Imagine quickly sharing your newly created image or
document or recipe with the world. 
Your app could have a button to "store all my files in the cloud", or "publish all my files when I
save them", or "automatically share files that are part of Project X with my boss".  More to the
point, you can work with files directly *in* the cloud. 
So a backup program, for example, could back up your files straight into Ubuntu One and not sync
them to your local machines.  That's exactly what Deja Dup, by the great mterry, does; one of its
backup options is "Ubuntu One". So to make sure you've got backups of your machine, just start Deja
Dup (which is in Ubuntu 11.10), choose "Ubuntu One" for backups, and that's it; you're done. 
You'll never lose data again; yay for backups!  Enabling that sort of work in *your* apps is exactly
what the Ubuntu One app dev programme is all about; making it easy to add your users' personal cloud
to what your app does. 
And of course being able to save things in and out of the cloud means that you can get an Ubuntu One
sync solution on other platforms.  So you could work with your files from your non-Android mobile
phone (we've already got Ubuntu One files available in the Android Market, and it's also on
Launchpad if you want to look at how it works). 
Build a fuse or gvfs backend for Ubuntu or Fedora or SuSE or Arch Linux. Build a WebDAV server which
works with Ubuntu One and mount your Ubuntu One storage as a remote folder on your Mac.  And web
apps can work with your cloud too, for files as well as data. 
Imagine, say, a torrent client, running on the web, which can download something like a movie or
music from and save it directly into your cloud storage.  So you see an album you
want on that torrent site (say, Ghosts I by Nine Inch Nails) and go tell this web torrent client
about it (and you've signed in to that web torrent client with Ubuntu One) 
And the website then downloads that NIN album directly into your personal cloud -- which of course
makes it available for streaming direct to your phone.  You could do that with videos as well:
choose a torrentable video (say, Beyond the Game, the documentary about World of Warcraft) and
download that directly into your cloud, if someone built the web torrent client. 
(Of course, that would be cooler if Ubuntu One offered a video streaming service as well as music
streaming, wouldn't it. Hm... ;-) But it's not just about your content for yourself; think about
Ubuntu One lets you share a folder with people. This would be great for distribution.  Imagine that
you publish an online magazine. 
So, you create a folder on your desktop, and put issues of the magazine in it.  Then, you put a
button on your website saying "Sign in with Ubuntu One to get our magazine". 
When someone signs in, your website connects to the Ubuntu One files API, with your private OAuth
token, and adds that signed-in user to the list of people that your magazine folder is shared with.
Then, whenever your magazine has a new issue, you just drop it into that folder on your desktop. 
(Or even upload it to Ubuntu One directly through the website.) All the subscribed people will get
the new issue instantly, on all the machines they want it on, and in the cloud. 
You could distribute anything like this. Imagine a podcast, or chapters of a novel.  It would also
work for paid-for content; when someone pays, have your code share a folder with them, and put their
paid-for stuff in that folder. That's all doable through the files API. 
We've built the files API itself (an HTTP-based REST API) and also some wrappers for it to make it
easier to use in your apps from Python and the like (and we're continuing to enhance it, and this is
another place you can contribute; let me know what you want the Files API to do!) infodroid asked: i
hear that couchdb as a backend for a desktop app is really slow. is this true? are there any
strategies to get around this? 
infodroid, we're working on ways to make synced data a better experience for developers 
(In fact I've been in a meeting room today talking about it :)) 
so stay in touch with what we're up to and if you're having problems, be assured that things will
get better at the moment using couchdb is problematic, we agree; for some people it works fine but
there are issues 
we're still working out what it's best to do about that 
There are 10 minutes remaining in the current session. 
staying in touch with what's going on can be done by following the blog
( and we're on twitter as well :) and you can hang out in
#ubuntuone too; we're a friendly bunch 
and I'm always happy to have someone buy me a beer ;) (Or just drop me an email or ping me on irc to
chat about what you're trying to do or hoping to do. I like talking about this stuff, as you may
have noticed.) OK, I've talked about a blizzard of ideas that'll be made possible, and shown you
almost no code. 
However, code is nothing without documentation, and that's really important. 
So, as I mentioned earlier, you want 
There you can find documentation for the files and music APIs, and for how to create and manage your
Ubuntu One account.  So there's documentation for all this stuff so all of you clever people can
build things that I haven't even dreamed of. 
So, what I'd like to know is: what are your cool ideas? What help do you need from me in making them
happen? What do you want to use Ubuntu One for in your apps and your scripts and your work?  as I
say, drop me a line, ping me on irc, tweet at me or at U1 or hang out on irc and tell me what you
want to get done, and we can talk about how to do it 
I've got a few minutes fo questions now before you get to hear cool stuff about unity :) 
There are 5 minutes remaining in the current session. 
kermit66676, syncing your shotwell structures is a really interesting idea 
you should already be able to sync the photos themselves -- simply mark the folde with them in as
synced with Ubuntu One, and they'll be on all your machines syncing shotwell's preferences and so on
is more interesting, because it depends how they're stored 
catch up with me another time (I have to leave at the end of this talk :( ) and we can talk it over? 
ok, thanks all! 

MeetingLogs/appdevweek1109/UsingUbuntuOneApis (last edited 2011-09-08 13:16:20 by dpm)