You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

dega's avatar
dega
Explorer | Level 4
8 years ago

API V2 Modified date for specific revision of a file in Python

Hi,

I am trying to get the metadata for a specific revision of a file, 

with V1 I used to do:

 

metadata = client.metadata(FileName, list=False, file_limit=1, hash=None, rev=revN, include_deleted=False)
 

 then I had it in "metadata['modified']".

 

 

Now I can only see how to download a particular revision or get the metadata for the last N (up to 100) revisions of a file. What if I have more than 100 versions?

 

P.S.

How I can specify the revision in the path, as the SDK states for "file_download"?

 

files_download(path, rev=None)

Download a file from a user’s Dropbox.

Parameters    • path (str) – The path of the file to download.

                        • rev (Nullable) – Deprecated. Please specify revision in path instead. 

  • In this example, you would call like this:

     

    dbx.files_download('rev:2bc3d561afc23')

    You don't need to specify the file path itself. You just need the "rev:abc123" format. The rev string actually identifies the file without the use of the path.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    API v2 only supports listing up to 100 revisions, but I'll pass this along as a feature request for more.

    To specify a particular revision in the `path` parameter, you should use a string like "rev:abc123" where abc123 is the rev string for the revision you want.

    • dega's avatar
      dega
      Explorer | Level 4

      Hi Greg, yes being able to go back more than 100 revision I believe will be something very nice to have.

       

      Regarding the files_download, passing the revision inside the path, I tried this (and lots of different combinations):

      dbx.files_download(FileName + "?rev:u'2bc3d561afc23'")

      but it gives me an error, however 

      dbx.files_download(FileName)

      retrieves the latest file (as expected).

      Moreover

       dbx.files_download(FileName,u'2bc3d561afc23')

      retrieves the version I was looking for, so the revision string is correct.

       

      Am I missing something?

      I am tring to follow the guide not to implement something that will soon be deprecated.

       

      Thanks,
      Marco

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        In this example, you would call like this:

         

        dbx.files_download('rev:2bc3d561afc23')

        You don't need to specify the file path itself. You just need the "rev:abc123" format. The rev string actually identifies the file without the use of the path.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!