How to share a folder using the Ubuntu One Web API

Posted by Mario César on Ask Ubuntu See other posts from Ask Ubuntu or by Mario César
Published on 2013-10-22T15:42:20Z Indexed on 2013/10/22 16:03 UTC
Read the original article Hit count: 766

I have successfully implement OAuth Authorization with Ubuntu One in Django,

Here are my views and models: https://gist.github.com/mariocesar/7102729

Right now, I can use the file_storage ubuntu api, for example the following, will ask if Path exists, then create the directory, and then get the information on the created path to probe is created.

>>> user.oauth_access_token.get_file_storage(volume='/~/Ubuntu One', path='/Websites/')
<Response [404]>
>>> user.oauth_access_token.put_file_storage(volume='/~/Ubuntu One', path='/Websites/', data={"kind": "directory"})
<Response [200]>
>>> user.oauth_access_token.get_file_storage(volume='/~/Ubuntu One', path='/Websites/').json()
{u'content_path': u'/content/~/Ubuntu One/Websites',
 u'generation': 10784,
 u'generation_created': 10784,
 u'has_children': False,
 u'is_live': True,
 u'key': u'MOQgjSieTb2Wrr5ziRbNtA',
 u'kind': u'directory',
 u'parent_path': u'/~/Ubuntu One',
 u'path': u'/Websites',
 u'resource_path': u'/~/Ubuntu One/Websites',
 u'volume_path': u'/volumes/~/Ubuntu One',
 u'when_changed': u'2013-10-22T15:34:04Z',
 u'when_created': u'2013-10-22T15:34:04Z'}

So it works, it's great I'm happy about that. But I can't share a folder.

My question is? How can I share a folder using the api?

I found no web api to do this, the Ubuntu One SyncDaemon tool is the only mention on solving this https://one.ubuntu.com/developer/files/store_files/syncdaemontool#ubuntuone.platform.tools.SyncDaemonTool.offer_share But I'm reluctant to maintain a DBUS and a daemon in my server for every Ubuntu One connection I have authorization for.

Any one have an idea how can I using a web API to programmatically share a folder? even better using the OAuth authorization tokens that I already have.

© Ask Ubuntu or respective owner

Related posts about ubuntu-one

Related posts about application-development