cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: How to get last modified date for folders in Dropbox V2 API ?

How to get last modified date for folders in Dropbox V2 API ?

Ankita W.
New member | Level 1

Hi,
I am trying migrate from v1 to v2 and get to the user's root folder and view all the list of files and folders with last modified date. I am passing "https://api.dropbox.com/2/files/list_folder" to get the list.

Currently I am getting "NaN/NaN/NaN" as last modified date for folders, the list is not in sorted order and size of file is not proper. And, I am also not able to open the folders.

I am using OAuthClientRequest and passing the json as 

String requestJson = "{\"path\": \"\",\"recursive\": true,\"include_media_info\": true,\"include_deleted\": false,\"include_has_explicit_shared_members\": false}";

requestQ.setBody(String.valueOf(requestJson));
requestQ.addHeader("Content-Type", "application/json");

For response I am using :
OAuthClient clientResponse = new OAuthClient(new URLConnectionClient());
OAuthResourceResponse resourceResponse= clientResponse.resource(requestQ, OAuth.HttpMethod.POST, OAuthResourceResponse.class);
Please suggest me !
21 Replies 21

BouzianeAmineLocalfr
New member | Level 2

Hello,

 

Is there any updates regarding this subject ? if it's the case can you point me to the doc.

 

And thanks.

Greg-DB
Dropbox Staff

@BouzianeAmineLocalfr No, unfortunately I don't have an update on this feature request.

BouzianeAmineLocalfr
New member | Level 2

Thanks for replaying, so fast.

Miros
New member | Level 2

Seriously? Is it really not possible to get create/modify date/time for files and folders using the Dropbox API?

Greg-DB
Dropbox Staff

@Miros Modified time is available for files, but not folders. Created time is not available for either. You can find the full documentation on the different pieces of metadata that are available for different types in the documentation, such as for /2/files/get_metadata.

Diegovsky
New member | Level 2

Watching for changes isn't feasible if the user turns off their computer or loses connectivity. It seems that dropbox.com is able to show the last modified dates for folders so why isn't that exposed thorugh the V2 API?

 

Also, maintaining a live connection with dropbox would kinda suck since it would keep constantly polling for changes (which is expensive) and will consume a lot of band/API requests. What does the dev team recommend to solve this issue (that is: noticing server changes)? Is there a better way to know if there were any changes on the server?

 

My application is a oneshot app, which means it only compares disk changes and server changes once, synchronizes what has changed and then shuts off.

Здравко
Legendary | Level 20

@Diegovsky wrote:

Watching for changes isn't feasible if the user turns off their computer or loses connectivity. ...

Also, maintaining a live connection with dropbox would kinda suck since it would keep constantly polling for changes (which is expensive) and will consume a lot of band/API requests. ... Is there a better way to know if there were any changes on the server?

 

My application is a oneshot app, which means it only compares disk changes and server changes once, synchronizes what has changed and then shuts off.


Hi @Diegovsky,

In your case it's easy. You don't have to "keep constantly polling for changes". Just keep the last list cursor and whenever you want (i.e. you application runs next time) just try listing continuation. If the resulting list is empty,... no any changes. Just save the received cursor for next use and nothing more. If there are entries, they are last modified entries. Sync them, save received cursor for the next try and... it's ready. 😉

Hope this helps.

 

PS: By the way, there are no any timestamps for directory changes in dropbox.com. Where you have seen them? 🧐

Diegovsky
New member | Level 2

Indeed. I was using the python SDK so I didn't look much into this continuation API. Thanks for pointing me towards the right direction 👍

 

Regarding timestamps of folders, I just selected this folder and it shows me this info ("Modificado" meaning "modified" in english):

Diegovsky_0-1644686495369.png

 

Здравко
Legendary | Level 20

It's meaningless if you are using direct API calls or some SDK. You should be able access the same features anyhow (to the discussed context, at least).

 


@Diegovsky wrote:

...

Regarding timestamps of folders, I just selected this folder and it shows me this info ...


😁Don't mess you local folder properties with those available throughout Dropbox website! 😉 What's on your screenshot?! Is it dropbox.com content?! 🤔😜 Your local folder will always have properties like any other local folder (either in sync by hand or using Dropbox app). Those properties are not in sync (they are no object of sync)! Till some future moment when this will change.

Hope this clarifies matter.

 

Edit: Oh... Sorry! There really are such "Modified" labels. You can easy see that they are incorrect. Looks like those moments are derived calculations... anyway - unusable.

Diegovsky
New member | Level 2

I seems to be derived, indeed.

Need more support?