[Solved] Install And Use Api On Windows

Recommended Posts


I would like to use the API with php. My installation is on windows and I cant make it work!


As far as now : 

I got a "sync.conf" file but the command don't run the programme silently :

"C:\Program Files (x86)\BitTorrent Sync>BTSync.exe /config sync.conf"


i'm trying to check if it work on chrome, looking at 



And with a php wrapping of the API with wamp : 



my sync.conf :

{    "storage_path" : "./",    "use_gui" : true,    "webui" : {        "listen" : "",        //"login" : "<someusername>",        //"password" : "<somepassword>",        "api_key" : "API-KEY"    }} 

index.php : 

<?php	include("btsync.php");		$client = new BTSync();	$p = $client->getFolders();	var_dump($client);	var_dump($p);?>
Link to post
Share on other sites

Are you on windows?

Because i ask the support team they answered :



Dear user,

Unfortunately, API for Windows can't access it yet. So far only for Linux. We will consider a way to enable it for Windows as well.

Best regards,
*Sync Support Team.
Link to post
Share on other sites



Yes, I did the test on Windows. You've got a correct answer from Sync Support. They answer that API for windows can't access it ("it" =  URL, which is pretty much the same as I told.


If you see some contradiction here - please elaborate, so I can explain it in a more detailed way.

Link to post
Share on other sites

When I try to access to :


It does not work. So i imagined that it was the same as using the API.

But if it work for you wy it doesn't for me? I'm jealous!


Dit it work for you when you do that:

"C:\Program Files (x86)\BitTorrent Sync>BTSync.exe /config sync.conf" (it does not for me again)


If you have any idea, I take it. My version is 1.3.105 and I use windows 7 family edition. 

Link to post
Share on other sites



Yes, I'm starting btsync with pretty much same command as you do from console. I did a test on Win7 x64 and WinXP x86 using your config file (except the fact that I've replaced API-KEY with my API key).


The URL should return an empty JSON data which is going to look like 2 empty square brackets:

[  ]

So, just to make sure that simple stuff is covered:

1. What do you mean under "non-working"? Are you getting a timeout or some other error message?

2. After you run the command line - do you see BTSync icon in the system tray appear? Is the btsync process seen in the tree or it exits immediately \ after some time?

3. Is there any other instance of BTSync running simultaneously?

4. Do you place your API key instead of "API-KEY" (I know it sounds very simple - just want to make sure you check this as well)?


Don't be jealous, we'll do our best to make your API working :)

Link to post
Share on other sites

I investigate that point.


On the task manager it appears and get quickly killed, without any message.

I believe it act like there is an other instance of BTSync active. Before I try the command line i quite BTSync with a right click and quit on the process-bar icon.


As it start running from the command line with the configuration file  the memorie used (into the task manager) is around 2 000k but when i run it without the configuration file (still with command line) it use about 25 000k. So he may not like my conf file or  there is a lock file (like this F***g firefox on linux when it crash !!)


How does it act if you put a wrong API-KEY ?


(yes i change the "API-key" nothing is too simple)

Link to post
Share on other sites



There is a known issue with API for Windows: it never shows the error code / text when something is going wrong. The only difference I see between your environment and mine is the API key.


...which makes me think that something is wrong with your API key. 


I suggest you sending me your whole config file unchanged (yes, with API key untouched - it won't be considered as terms violation as I'm BitTorrent employee, do not worry) and i'll check it in my lab. Send the file, don't copy-paste the content to make the test clean. Use syncapp@bittorrent.com e-mail address, note this forum topic in message body for ease of search.

Link to post
Share on other sites




That is exactly what a pirate would have said !!

Well... why did you sent the key then ;)?


Anyway, I have some good news for you.

1. Your API key is okay and not revoked.

2. Your config with API key worked just fine in my environment.

3. Thanks to one of our support engineer (Helen) I have a good guess that I know why it is not working for you. It is very likely that you are running btsync.exe right from the "program files" folder - which is protected by UAC. While your config tells it to put all the data directly into the same folder is binary - OS prevents that and btsync simply can't run further.


So - either move your binary from the program files, or just put your storage folder in some other location. Here is a sample config which is going to work:

{    "storage_path" : "C:\\MyAPIStorage",    "use_gui" : true,    "webui" : {        "listen" : "",        //"login" : "<someusername>",        //"password" : "<somepassword>",        "api_key" : "<your_API_key"    }} 

3 small notes:

1. MyAPIStorage folder must exist

2. When putting paths for Windows OS - use backslashes as component delimiters

3. As backslash is a special character in JSON - you have to escape it (put twice).

Link to post
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.

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.