kos13

Sync API wishlist

Recommended Posts

I would like the desktop and the Android versions to allow for other programs to connect without forcing the user to manually add folders through the BitTorrent Sync interfaces.

First, a Sync success story: I wrote my own time-management software, originally just a desktop application. All of the application data storage is in simple text files, so it was easy as pie to write an Android application in Perl (SL4A ftw) to view my current tasks, or even update them. I wanted to keep the phone and desktop data in sync, I wanted my phone to have access to the data even if I drop out of cell phone coverage, and I didn't want to write my own data synchronization app or service. Thanks to Sync, get this for free. If I make my desktop and SL4A apps save their state in the text files (which they already do), I can leave all of the data synchronization to Sync. The apps don't talk directly so I don't get realtime synchronization, but I don't need realtime synchronization: I just need a system so that if I modify something on my computer, I can easily view it on my phone 10 seconds later, and neither application has to provide a complicated data exchange service. BT Sync is perfect for this.

Now for the API part. I had to set this up manually. I had to open Sync on my computer and start sharing the folder. Then I had to go to my phone and create a new folder, and link it to the computer's folder. It wasn't hard, but ideally btsync would provide some sort of interface so I could invoke this setup within my own application. My desktop planning software could contact btsync and say, "btsync, add $this_folder" and then "btsync, flash the QR code for $this_folder." Or, "btsync, add $this_folder and give me a QR image (or a secret)" and leave the display of the QR or sharing of the secret to the software. Whether it's better to leave the QR display to me, or have it clearly and prominently displayed as BitTorrent, I leave up to the BitTorrent devs. My Android planning software could contact its Android btsync service and say "Please run 'Add sync folder' for $this_folder", which would pull up the Android Sync "Add sync folder" screen with the folder already chosen, and would return to my app when the user hits "Done". (Then, because I'm lame, it would probably just say, "All set up! Please wait for a few minutes as BitTorrent Sync synchronizes your data." I suppose I could do better if I could query the status of the sync and show a display bar to the user. But really, that sort of thing is secondary in my mind.)

In short, an API to let programs invoke btsync to set up a share would be really nice.

Share this post


Link to post
Share on other sites

Here is basically what I need from the sync api:

Add new Sync folder for specified key

Remove Sync folder

Watch folder with notification callback when update is in progress and also per file when each has been completely updated

What would be terrific but probably a version 2 feature...

An embedable BTSync which can be transparently installed with another application to be dynamically linked and controlled without installation and without interfering with other BTSync installations on the computer.

Share this post


Link to post
Share on other sites

First of all, I really love your work! It has great potential to become the universal file sync backend for many future applications.

Right now I'm developing an open source C++/Qt-based multi-platform application framework for small/medium business and intranet applications. The idea behind this is not far from the BTSync concept:

Instead of having dedicated database servers storing data and web servers providing user interfaces, it will be all together inside a single desktop application. It uses SQLite for offline data storage as a local backend and also has a shared database system on top to exchange and synchronize data with it's peer applications. The application can discover it's peers on the local network using broadcasts and share connection details about known peers.

It provides an native interface for creating new database and tables that are shared between the peers. User Interfaces for specific apllications frontends are QML/HTML5 based and also stored and in database and may be shared between peers.

I think you can imagine where this is going. We were planning to create some file sync backend for sharing documents and binary data as well. Network shares or FTP cannot do what we need.

And then BTSync was released and does exactly what we are looking for.

So please make your API C++. It will be very useful for a lot of developers out there. Java or some other scripting language brings too much restrictions. Keep it low level and simple. Leave the idea of web based api behind as you did with the cloud. Developers can provide this on their own if they have a low lvl C++ API.

I want to see more peer-to-peer based scalable "crowd computing". This this is the future in my opinion. It would have so much potential this way and help us a lot with our work.

Share this post


Link to post
Share on other sites

A lot of the suggestions here are really complicated... All I really want is to be able to specify a directory my app can read/write to, specify the secret for the directory, and have that directory kept in sync.

 

That and basic callbacks for whenever anything changes (eg: if a file is sent to at least one other machine, I'd like to update the user interface).

 

Basically I'd like to use BT Sync to keep data in my app in sync with data on any other devices/pc's a user has. Perhaps I might also run a server of my own with a copy of the data, which is available 24/7/365.

Share this post


Link to post
Share on other sites
  • All the existing BTSync gui functions exposed
  • Get a file list
  • Get and Put an individual file (Like the phone apps)
  • Change Events
    • New File Added
    • Existing File Changed
    • New Host Connected
    • File Requested from another host
    • etc

 

Nothing out of the ordinary I think.

 

Keep up the good work, love BT Sync, only thing I've been wanting has been an option to only download specific files due to the small SSD on my Laptop.

Share this post


Link to post
Share on other sites

As per http://forum.bittorrent.com/topic/24793-request-ping-url-on-sync/

 

I'd like a way of registering events, so when an event is triggered, like 'Files synced', BT Sync will then trigger my registered command/url with some data.

 

This means that instead of my application having to poll the sync folders, btsync will tell me application when I need to deal with the changes.

 

 

Something like:

 

api?method=reg_event&event=sync&secret={secret}&type={url|cmd}&(url={url}|cmd={cmd})

Share this post


Link to post
Share on other sites

Get Secret by Folder/Use folder as an argument.

 

Currently you can use a Secret as the argument of most methods, but if you want to find the secret of a specific folder, or want to get the prefs of a folder that you don't know the secret of, you need to first run 'get_folders' and extract the data secret. It'd be nice if any method that took 'Secret' as an argument could also take 'Folder'.

Share this post


Link to post
Share on other sites

I second gorpo's wish list. My needs are simple, I want basic functionality available via API for mobile apps. I primarily intend to use BTSync shares as external storage / export for app data.

 

I second the suggestion for mobile API.

 

It will be extremely useful for developers who write mobile apps that need to sync files with computer / server / another device.

Share this post


Link to post
Share on other sites

Request:

 

Give a possibility to identify folders regardless of the secret type

 

My use case:

 

I'm building a web service which uses BTSync API to add folders and share them to team members. I don't want to store any RO/RW keys on the server so I decided to store only ENC secret as a ID of a given folder. This way if someone want to sync a folder I have a list of peers with different access ENC/RO/RW. I want to query them to get at least a RO secret by a ENC secret in my case.

 

The problem:

 

/api?method=get_folders&secret=xxxx - Returns result only when same type of secret is used when the folder is added, so if you add folder as RW, you cannot find it by RO or ENC secret.

 

Possible solutions:

  • Folder ID - One solution is to generate folder ID which can be used to find folder without a secret
  • Use any secret type for get_folders method - This way I can filter the folders regardless of the secret type used when they were added

 

My workaround:

 

My workaround at the moment is as follows (My service use only encrypted folders):

  • Person requests my server to get a RO or RW secret by its ENC secret
  • Server sends request with ENC secret to all peers which shared this folder with the person
  • Each peer calls get_folders method without a secret and gets all the folders secrets
  • Then calls get_secrets for each secret and collects the result
  • Filters the result by matching the ENC secret and returns corresponding RO or RW secret or NotFound depending on access granted for the person which request it

 

 

I don't know if its worth the effort to be implemented in the API or any other problem this could bring, but I hope the BTSync team will come up with something. This use case also applies to files where you have different secret types on each peer and want to get the download status, file names and so on.

Share this post


Link to post
Share on other sites

I would like to suggest adding JSONP support to the api as this would help develope non local Javasript API clients.

 

Currently I'm forced to use a proxy to envelope my requests in JSONP.

 

 

Also I'm quite new to the whole Bittorrent protocol: Is there a JS client for btsync that could enable a web frontend to download files?

 

 

Thank you very much

Johnnycube

Share this post


Link to post
Share on other sites

I will start a music streaming software, here's what can it make it better:

 

- API for recieving file stream (file streaming)

- Parameter to force the seeds to stream the file from the beginning (so the music can start faster, and won't stop because of an unlucky order)

Share this post


Link to post
Share on other sites

Not sure whether it has already been mentioned. A sortable "Folders" rider for "Path" in the application windows would be helpful to keep an overview over a crowd of sync folders.

Share this post


Link to post
Share on other sites

Ability to make the request url be able to be SSL.

For example (listed in API documentation):

http://[address]:[port]/api?method=get_folders[&secret=(secret)]

 

Allow for HTTPS

https://[address]:[port]/api?method=get_folders[&secret=(secret)]

Share this post


Link to post
Share on other sites

A function where people can only write to the files they added to a share would be great. For example, there could be a normal read/write key, a read-only key, and a read-all/write-to-your-data-only key. That way, people could create collaborative shares without worrying that other users can delete their data.

Share this post


Link to post
Share on other sites

Since due to selective sync and syncignore, files doesn't necessarily exist on all connected hosts, it would be useful to know the current redundancy of a file in the sync folder.

 

We're working on a decentralized storage of our data on several computers. If a file only exists on a single host (all other hosts ignore it) that host should know that. Deleting it would be bad then... :-)

 

So, the get_files api method should include a field "availability". A new method "get_file_peers" could return all peers, that currently share this file.


Another selective sync feature: searching for files. Currently you have to browse the "virtual tree" recursively via get_files to search for a specific file. I'm sure, the client could to this much faster. A find_file api method could return an entry similar to the get_files items  (almost... it must include a "path" entry) if a file exists... or an empty object, if not. And... yes, why not... what about a find_files_regex method? ;)

Share this post


Link to post
Share on other sites

Hello,

 

First of all I'm for REST API.. and little change about identifying folders.. Now it is by secret (with no possibility put same and different type (RO) secret to different folder (now have to convert RW to RO and have everything in 2 folder .../.tmp/RO_SECER but i want to separate it for users to home folders and don't mix downloaded files and sizes)) i know it is common to use it like this but what about this: 

 

- GET: http://btsync:8888/rest/"shareds"/

  -> [{id: auto_increment, secret: 'XYZ', folder: '/fome/whoami/xyz', ...}, {..}, {}]

 

- POST: http://btsync:8888/rest/"shareds"/ (option for create folder)

  DATA: {secret: 'XYZ', folder: '/fome/whoami/xyz', ...}

  -> {id: 1, secret: 'XYZ', folder: '/fome/whoami/xyz', ...}

 

- GET: http://btsync:8888/rest/"shareds"/1/ (also PUT and DELETE)

  -> {id: 1, secret: 'XYZ', folder: '/fome/whoami/xyz', ...}

 

- GET: http://btsync:8888/rest/"shareds"/"1"/files/"path" OR ?path="path" (priority on inUrl)

  -> [{name: 'FOO', size: null, download: 0, ...}, {..}, {}]

 

- ...

 

Next think, will be nice to have option "keep" for selective sync file with possibility to automatically delete file after download=0 (now I'm creating thumbnails and when i download and convert file for sync explorer it make some sync mess when i delete it by app)

 

Of course will be good to have option to use SSL and be able to chose certs in config file

 

Share this post


Link to post
Share on other sites

I'm trying to write a wrapper around BTSync using the API so I can handle all the shares programatically.

 

I'd like to see the config being passed as value to the app in an argument rather than only as a feel on HDD. This way I can keep my api key hidden away when I pass the parameters to the app at startup.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now