cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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

Greg-DB
Dropbox Staff

API v2 doesn't return modified time in FolderMetadata, but I'll be sure to pass this along as a feature request. 

Regarding the order of items returned by list_folder, your app should process them in the order given in order to get an accurate representation of the state of the account. Once you have all of the metadata, you can sort items as desired on the client.

I'm not sure what you mean by "size of file is not proper" or "I am also not able to open the folders" though. Can you elaborate on those issues?

Ankita W.
New member | Level 1

Hi Gregory,

Thanks for your reply ! My other queries got fixed. Is there any other way by which we can get last modified date for folders ?

 

Greg-DB
Dropbox Staff

The only workaround would be to use list_folder to list all of the contents of the folder and monitor for changes to them, recording the latest time as the modified time for the folder.

Saar A.
Explorer | Level 4

Are there any news regarding this issue?

Greg-DB
Dropbox Staff
No, unfortunately I don't have any news on this request.

haktech
Explorer | Level 3

Hey Greg K., I'm really getting confused between the ClientModifiedDate and ServerModifiedDate. Can you please help me to figure this out? I have been testing this and each time i updated a file via the API, i noticed both of them were being updated with exactly the same datetime value..

 

What is the difference between them? In my app, i have filters and one of these is filtering by modified date. Which one is more accurate to refer to, ClientModifiedDate or ServerModifiedDate? The modified date that is showing in the Dropbox portal, is the server one or client one?

 

Thanks.

Greg-DB
Dropbox Staff

@haktech You can find descriptions of client_modified and server_modified under the documentation for FileMetadata, e.g., under the return value documentation for /2/files/get_metadata.

 

In short, the server_modified time is the time from the server when the file was modified. This is more trustworthy, since only the Dropbox server can set this.

 

The client_modified time is supplied by the client, and not verified by the server, so it should only be used for display purposes.

 

You can set the client_modified time explicitly, by using the client_modified parameter when uploading files, e.g., via /2/files/upload. If that isn't supplied, client_modified will automatically be set to the same as server_modified.

 

The dropbox.com site displays the client_modified value.

PowZone
New member | Level 2

Hello,
I need the last modification date on folders too.

Any news on this feature?

thanks

Greg-DB
Dropbox Staff

@PowZone No, unfortunately I don't have any news on this.

Need more support?