cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Ankita W. New member | Level 1
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 !
9 Replies 9

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

Dropboxer
Dropboxer

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?

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

Ankita W. New member | Level 1
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 ?

 

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

Dropboxer
Dropboxer

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.

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

Saar A.
Explorer | Level 4

Are there any news regarding this issue?

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

Dropboxer
Dropboxer
No, unfortunately I don't have any news on this request.

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

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.

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

Dropboxer
Dropboxer

@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.

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

PowZone New member | Level 2
New member | Level 2

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

Any news on this feature?

thanks

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

Dropboxer
Dropboxer

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

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?