jinzhao

New Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by jinzhao

  1. Hi,

     

    I'm wondering whether I can call the API to grant access to a shared folder?

     

    The API document says:

     

    /AccessRequests

    This is the path to get and grant access for requests from other users.

     

    But there's only support for get method for this end point. Is this something not implemented yet?

     

    I want to develop an app that users can directly share folders to other users, and the access from other users will be automatically granted.

     

     

    Thanks

  2. I made a python sample that can recreate this problem.

    import requestsimport jsondef test_api():    url_token = "http://localhost:8888/api/v2/token"    url_add_folder = "http://localhost:8888/api/v2/folders"    url_debug_log = "http://localhost:8888/api/v2/debug/log"    s = requests.session()    # get token.    r = s.get(url_token)    print "1:Fetched cookies was %s" % s.cookies    json_response = json.loads(r.content)    token = json_response["data"]["token"]    print "2:Token was %s" % token    # add folder by post.    data = {"path": "/Users/zhaojin/Documents/abc", "token": token}    r = s.post(url_add_folder, data)    print "3:Result was %s" % r.content    print "4.Request header was: %s \n Request body was %s" % (r.request.headers, r.request.body)    # print s.get(url_debug_log).contentif __name__ == '__main__':    test_api()

    the result is:

    1:Fetched cookies was <<class 'requests.cookies.RequestsCookieJar'>[<Cookie GUID=39M3ObaYHoggLHrAcdVi for localhost.local/>]>2:Token was Aj6LD8j5qXv8cyoDiqF7SjR4gWPv_3xaCa8ySDby2C8pQ6nokWkOXJZHNFYAAAAA3:Result was invalid request4.Request header was: CaseInsensitiveDict({'Content-Length': u'112', 'Accept-Encoding': 'gzip, deflate, compress', 'Accept': '*/*', 'User-Agent': 'python-requests/1.2.3 CPython/2.7.3 Darwin/14.4.0', 'Cookie': 'GUID=39M3ObaYHoggLHrAcdVi', 'Content-Type': 'application/x-www-form-urlencoded'})  Request body was path=%2FUsers%2Fzhaojin%2FDocuments%2Fabc&token=Aj6LD8j5qXv8cyoDiqF7SjR4gWPv_3xaCa8ySDby2C8pQ6nokWkOXJZHNFYAAAAA

    As the result shows, it seems that I correctly retrieved the cookie from the token api, and passed it to the add folder api.

    But it's still rejected.

     

    The log shows:

    [13:51:03]  REST API: Can't fulfill request without valid token

    Any ideas where I did wrong?

     

    Thank you!

    Jin

  3. Here's the log:

    [2015-10-30 12:31:23] API: --> getsyncfolders(discovery=1&t=1446175883918)
    [2015-10-30 12:31:24] API: --> getsyncfolders(discovery=1&t=1446175884934)
    [2015-10-30 12:31:25] API: --> getsyncfolders(discovery=1&t=1446175885965)
    [2015-10-30 12:31:27] API: --> getsyncfolders(discovery=1&t=1446175886997)
    [2015-10-30 12:31:28] API: --> getsyncfolders(discovery=1&t=1446175888019)
    [2015-10-30 12:31:29] API: --> getsyncfolders(discovery=1&t=1446175889036)
    [2015-10-30 12:31:30] API: --> getsyncfolders(discovery=1&t=1446175890057)
    [2015-10-30 12:31:31] API: --> getsyncfolders(discovery=1&t=1446175891093)
    [2015-10-30 12:31:32] API: --> getsyncfolders(discovery=1&t=1446175892123)
    [2015-10-30 12:31:33] API: --> getsyncfolders(discovery=1&t=1446175893153)
    [2015-10-30 12:31:34] API: --> getsyncfolders(discovery=1&t=1446175894189)
    [2015-10-30 12:31:35] API: --> getsyncfolders(discovery=1&t=1446175895221)
    [2015-10-30 12:31:36] API: --> getsyncfolders(discovery=1&t=1446175896254)
    [2015-10-30 12:31:37] API: --> getsyncfolders(discovery=1&t=1446175897276)
    [2015-10-30 12:31:38] API: --> getsyncfolders(discovery=1&t=1446175898294)
    [2015-10-30 12:31:39] API: --> getsyncfolders(discovery=1&t=1446175899311)
    [2015-10-30 12:31:40] API: --> getsyncfolders(discovery=1&t=1446175900328)
    [2015-10-30 12:31:41] API: --> getsyncfolders(discovery=1&t=1446175901361)
    [2015-10-30 12:31:42] API: --> getsyncfolders(discovery=1&t=1446175902390)
    [2015-10-30 12:31:42] REST API: Can't fulfill request without valid token

  4.  

    Hello,

     

    I've been learning Sync API for 2 days. I'm using sync free version and in the

    30 day trial of Sync Pro.

    I have a evaluation key for the API and I'm able to start Sync with config.

     

    I can successfully call the get APIs like http://127.0.0.1:8888/api/v2/token and http://127.0.0.1:8888/api/v2/folders, however I couldn't get the either of the post APIs to work like adding a folder.

     

    I've tried the following two ways:

    • curl -X POST -H "Content-Type: application/json" --user api:secret1 -d "{\"path\": \"C:/test\",\"token\":\"DZnGi1CRNwSVUzOcYJQ54SWEwjK7J2QRtZ6TV6ZmWE_oxN79RuW3TuG9MlYAAAAA\"}" http://127.0.0.1:8888/api/v2/folders
     

     

    Basically I call the token API to get a token, and passes it on the token field for the post API.

     

    I'm on Windows 8 64bit.

     

    What am I doing wrong?

     

    Thank you,

    Jin