Btsync Api .... For #bash , Without Api Key


Anh Huynh

Recommended Posts

Hello, world!

I don't have my API key (I don't know why I need to register to get an API key...), so I write some crazy stuff, to fetch #btsync json data directly from #btsync webui.

Now I can create #btsync cluster, add them to my #zabbix monitoring and enjoy :)

My code is here https://github.com/icy/cnystb . It's in Bash.

Supported methods

* `token/get`: return a valid token for `curl`-ing* `cookie/get`: return a vallid cookie for `curl`-ing* `curl/header/get`: return both cookie and token for your own test* `folder/get`: return all shared folders you see in `web` console* `folder/setting/get`: return the default folder* `os/type/get`: return the type of host's operating system* `version/get`: return the version number of `btsync`* `setting/get`: return general settings* `speed/get`: return the current download/upload speed* `key/get`: return (generate) a valid key pairs
An example

$ chmod 755 ./api.sh$ epport BTSYNC_USER=admin$ export BTSYNC_PASSWD="your-very-simple-password"$ ./api.sh curl/header/get{"cookie": "xxxxxxxxxxxxx","token": "xxxxxxxxxxxxx","at": 1408615780}$ ./api.sh folder/get{"folders": [{    "date_added": 1408417054,    "error": 0,    "files": 0,    "has_key": 1,    "indexing": 0,    "iswritable": 0,    "last_modified": 1408578957,    "name": "/home/btsync/data/kyanh-iphone4-camera",    "peers": [        {            "direct": 0,            "id": "xxxxxxxxxxxxx",            "is_connected": 0,            "last_seen": 1408454101,            "last_synced": 1408454085,            "name": "tinybox",            "status": "Synced on 08/19/14 20:14:45, Last seen 08/19/14 20:15:01"        },        {            "direct": 0,            "id": "xxxxxxxxxxxxx",            "is_connected": 0,            "last_seen": 1408579040,            "last_synced": 1408579040,            "name": "xxxxxxxxxxxxx",            "status": "Synced on 08/21/14 06:57:20, Last seen 08/21/14 06:57:20"        }    ],    "secret": "xxxxxxxxxxxxx",    "secrettype": 2,    "size": 0,    "status": "0 B in 0 files"},
Hope that helps :)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.