zycho42

New Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by zycho42

  1. Hi,

     

    when I remove a folder using api 2.0 any empty folders in the shared folder are removed. I'm using "deletedirectory":"false" . Is this a bug or am I missing something?

     

    I've also noticed the following:

    - setting "deletedirectory":"true" does not remove the folders from the harddrive.

    - sometimes removing folders results in a status_code other than 204 error and the folder is not removed. When removing say 10 folders I need to run my script several times before all folders are removed.

     

    This is the exact code I'm using (python):

    removed_folder = delete('http://my_ip:888/api/v2/folders/my_folder_key?token=my_token', delete={"deletedirectory":"false"}, auth=(my_user,my_password), cookies=my_cookie)

    If anyone can shed some light on this I'd be most grateful!

     

    Thanks,

     

    Willem

  2. @zycho42: Take a look at the sample projects: https://github.com/bittorrent/sync_slack

    You can get a hang of it and copy pasta stuff together to make a nice script.

    And I definitely recommend using either Googles Go or Python for it.

     

    I'll have a look at those sample projects. I'm doing this in python. Getting the session cookie to load in python is turning out to be not-so-simple, but calling curl through the shell gets it done. Anyway, getting waay off topic now.

     

    I'll figure it out from here! :-)

     

    Thx

  3. That did work for me at least.

     

     

    Ok thanks so much! After deleting the cookie and generating a new one it worked!

    However, if I read the docs correctly passing the token should be possible via the url as well as via json:

    When first connecting the developer should perform a GET /api/v2/token to retrieve asynchronizer token. This token must be added to all POST, PUT, PATCH and DELETE requests as one of the parameters as token=<token value> or for JSON request{ ... , "token" : "<token value>" ...}. Failure to include this token will cause an invalid request error to be returned. The developer will also need to return the session cookie on all requests.

     

    Appearantly passing the token through JSON is not working just yet...

     

    Thanks again for helping me out, I was stumped!

  4. Yeah no problem! I was just waiting for them to update the API page since I didn't want to "leak" information that is not yet public.

     

     

    Hey thanks for the quick response!

     

    I'm still puzzeled as this was exactly what I was trying after decyphering the instructions in the api v2 docs (I'm pretty new to all this http and json stuff), but I still keep getting the invalid request response (I'm on btsync v2.2.0(100) btw). Here's what I'm doing:

    $curl -c ~/btsync.cookie -u admin:pwd -X GET http://localhost:8888/api/v2/token

    which yields:

    { "data": { "token": "tokenstring" }, "method": "GET", "path": "/api/v2/token", "status": 0 }

    And then

    $curl -b ~/btsync.cookie -u admin:pwd -X POST -H "Content-Type: application/json" -d '{"path":"/path/to/folder", "token": "tokenstring"}' http://localhost:8888/api/v2/folders

    which returns

    invalid request

    I don't understand what's wrong here... Could you help me out?

     

    Thanks a lot.