Android Question Dropbox is Deprecating Sync API

Discussion in 'Android Questions' started by Mahares, May 7, 2015.

  1. Mahares

    Mahares Well Known Member Licensed User

    I have received an email from Dropbox team stating that they are deprecating Sync API. Here is the link to the news:
    https://blogs.dropbox.com/developers/2015/04/deprecating-the-sync-and-datastore-apis/#disqus_thread
    Can anybody who masters Dropbox explain exactly what that means to some of us who developed B4A applications using the Sync API:
    1. if our current applications will eventually cease to work in time.
    2. Will we still be able to continue developing for Dropbox or we need to start looking for alternatives..
    I am utterly confused.
    Thank you
     
    DonManfred and mangojack like this.
  2. DonManfred

    DonManfred Expert Licensed User

    Yes, if your app dont get updated skd (using a wrapper for core sdk)
    We still able. No need for alternatives.

    As of now there are different APIs. Some are only for mobile platforms. Some are already using the core v1 api.
    Sync- and Datastore-APIs will end of april 2016. Till this date Dropbox encourages us to update the SDK used changing to use the new upcoming core sdk v2 which will be relesed in the next 6 months. Core v2 will have support to sync and datastores i believe...

    So we need to switch to use another SDK in future but we CAN continue to develop with Dropbox

    See V2-Preview too.

    As far as i can say the following seems the base-statement of the new v2 API

    "Use whatever you want! It’s just HTTP."

    There are three categories of endpoints.

    • RPC-style: The request and response bodies are both JSON.
    • Upload-style: The request has JSON in the Dropbox-API-Arg header and bulk binary data in the body. The response body is JSON.
    • Download-style: The request uses the GET method and has JSON in the Dropbox-API-Arg header and nothing in the body. The response has JSON in the Dropbox-API-Result header and bulk binary data in the body.
    So we are able to upload files, download files, list folder contents, get metadata from file
    just by using http. So, developing an app using Dropbox can be made by using just httputils2
     
    Last edited: May 7, 2015
    Peter Simpson and mangojack like this.
  3. Mahares

    Mahares Well Known Member Licensed User

    Thank you Manfred as usual for tackling the most difficult of questions. Can someone please address the following scenario:
    I link to DropBox via an app with a secret and a key generated from a Dropbox app to simply upload files and download files to a folder on my PC that syncs with Dropbox. How do you use Httputils2 to accomplish the same thing without having a fixed URL or a web site.
    Thank you
     
  4. DonManfred

    DonManfred Expert Licensed User

    The upload is - like i already said - just http. When the file is uploaded then the Dropbox Client running on your PC should automatically download(sync) the new file(s)

    But i´ll have a try on this later or this weekend too... Maybe i can say more then
     
    mangojack likes this.
  5. Mahares

    Mahares Well Known Member Licensed User

    @Erel:
    Since you are the architect of the Dropbox library, what are you going to do to help the thousands of us that have applications that use Dropbox lib to upload and download files. As Dropbox team announced, the Sync API will be deprecated in 11 months. Will we be flooded with irate people complaining that their applications stopped working or will the applications continue to work even after the Sync API is deprecated.
    Thank you in advance.for a detailed explanation.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Once Dropbox stops supports the sync API then any app that still uses this API will stop working. There is nothing that I can do about this.

    I will provide a wrapper for the new Core v2 API. It is a different API and will require more work for developers to use (unlike the Sync API which was quite simple to use).
     
  7. Mahares

    Mahares Well Known Member Licensed User

    Thank you Erel for being there for us when we really need you. I can't wait to see your new wrapper for the Dropbox Core API. In the meantime, I have been trying to use HttpUtils2 for days to upload text files from my device to Dropbox, but I cannot figure out what to use for Dropbox URL to send or receive files. Can we upload/download files from/to Dropbox using HttpUtils2 without the use of Sync API.
    Thank you
     
  8. DonManfred

    DonManfred Expert Licensed User

    See V2-preview

    files/upload
    (upload-style)
    Note that the upload file size is limited to 150 MB. New API endpoints for uploading larger files (in chunks) are coming soon.

    Sample request:
    curl -X POST https://api-content.dropbox.com/2-beta/files/upload \
    --header "Authorization: Bearer <access-token>" \
    --header "Content-Type: application/octet-stream" \
    --header "Dropbox-API-Arg: {\"path\": \"/cupcake.png\", \"mode\": \"overwrite\"}"
    --data-binary @local-file.png

    Sample response:
    200 OK
    Content-Type: application/json
    {
    "name": "cupcake.png",
    "metadata": {
    "client_modified": "2015-03-26T21:31:57Z",
    "server_modified": "2015-03-26T21:31:57Z",
    "rev": "8e941b183490",
    "size": 59704
    }
    }

    files/download
    (download-style)

    Sample request:
    curl -X GET https://api-content.dropbox.com/2-beta/files/download \
    --header "Authorization: Bearer <access-token>" \
    --header "Dropbox-API-Arg: {\"path\": \"/cupcake.png\"}"

    Sample response:
    200 OK
    Dropbox-API-Result: {"name": "cupcake.png", "metadata": { ... } }
    Content-Type: application/octet-stream

    [​IMG]
     
  9. Mahares

    Mahares Well Known Member Licensed User

    Thank you @DonManfred for your quick response. I have looked at Dropbox V2 preview, but I have no idea or clue what it is all about. I also tried to understand your response in the previous post, but I have no idea or clue what your response is all about either.
     
  10. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Dropbox uses a REST API. This is essentially just an HTTP call which is stateless. It is possible to interact with Dropbox just doing HTTP calls. The only slightly difficult part is the authentication.
     
  11. mangojack

    mangojack Well-Known Member Licensed User

  12. Mahares

    Mahares Well Known Member Licensed User

    Thank you @TDS. I wish I can say your post helped me, but the problem remains: What URL to use, what authentication. If you had success uploading/downloading to/from Dropbox via HttpUtils2, can you please share a smidge with us.
     
  13. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Yes, one of my apps primarily uses Dropbox. I used Erel's tutorial to dropbox API V0 (deprecated now) and my own Dropbox authenticator library.
    I dont understand why Erel put it in the 'Old libraries forum' making it unsearchable as it works perfectly fine (although i dont spend time to answer support questions).
    You can see my app here which I havent updated in a long time.
    It was written in B4A 1.82. The code looks ugly, no classes, spaghetti coding in the service. I can send it to you if you want, but I dont know if you will feel more lost after that.

    I would wait for Dropbox API V2. It can easily be wrapped using B4A code, but the authentication part might once again need a java wrap (as i did before).
     
    mangojack and Mahares like this.
  14. Erel

    Erel Administrator Staff Member Licensed User

    By mistake. Moved back to the libraries list.
     
    hibrid0 likes this.
  15. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Thanks.
     
    NJDude likes this.
  16. DonManfred

    DonManfred Expert Licensed User

    If the files are not too big i got it working just with b4a, httputils2 (okhttp) and json

    [​IMG]

    I have tried it to upload files with a length of
    1mb
    5mb
    10mb
    20mb
    50mb
    160mb
    285mb

    The last two did not work.. i got a timeout exception... The limit is 150mb i think...

    To use greater files we need to use the chunked upload function of the api...

    i´ve started to implement this too yesterday... But it´s not ready as yet. Please note that my implementation is using the V1 api as it is not yet explemented in the V2 api...

    I created a small class which hold all the methods and raises events in the calling activity.

    Have a look at it yourself

    The example is using my STORAGE library to find my sdcardpath... You can just replace it with you own solution. The library is NOT needed by the dropbox class.
     

    Attached Files:

    Last edited: Jun 21, 2015
    Erel, lemonisdead and mangojack like this.
  17. DonManfred

    DonManfred Expert Licensed User

    I´ve tried to understand it and made a small example within the last days. See my previous post :)
     
  18. DonManfred

    DonManfred Expert Licensed User

    i got it managed. See post #16
     
  19. DonManfred

    DonManfred Expert Licensed User

    No. No need for a java-wrap. We can use just httputils2 to use the functionality. I really like the new previews of the Api V2 :)
     
    mangojack likes this.
  20. thedesolatesoul

    thedesolatesoul Expert Licensed User

    The reason for the java wrap was to invoke either the Dropbox app or the web browser to do the authneticate.
    Users were not comfortable entering their details in my app.
    Using HttpUtils2 can this be solved?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice