directory - add/modify/delete)
Challenge: Use Dropbox REST API to get the last updated timestamp of a directory (that includes changes to any of the files in the directory - add/modify/delete).
1) I tried using the API v1 first:
curl -XPOST https://api.dropbox.com/1/delta -H "Authorization:Bearer ********AuthorizationKey*********" --data "path_prefix=/toratoratora/reports"
{"has_more": true, "cursor": "**********CURSOR**********", "entries": [["/toratoratora/reports", {"rev": "7e3633bc43", "thumb_exists": false, "path": "/toratoratora/reports", "is_dir": true, "icon": "folder_user", "read_only": false, "modifier": null, "bytes": 0, "modified": "Tue, 22 Dec 2015 23:43:54 +0000", "shared_folder": {"shared_folder_id": "1099510378", "is_team_only_shared_folder": false}, "size": "0 bytes", "root": "dropbox", "revision": 126}]], "reset": true}
However, the timestamp returned above is NOT the last time a file in the directory was modified (add/modify/delete).
2) So, I tried using the API v2:
curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
--header "Authorization: Bearer ********AuthorizationKey*********" \
--header "Content-Type: application/json" \
--data "{\"path\": \"/toratoratora/reports/file_name.xlsx\",\"include_media_info\": true}"
{".tag": "folder", "name": "Reports", "path_lower": "/toratoratora/reports", "id": "id:******ID******", "shared_folder_id": "dbsfid:###dbsfid####", "sharing_info": {"read_only": false, "shared_folder_id": "dbsfid:****dbsfid****"}}
Although I've specified "include_media_info" as TRUE, the timestamp values for "client_modified" & "server_modified" are NOT included in the result as the request is for a directory and NOT a file.
3) No luck when I usedget_metada:
curl -X POST https://api.dropboxapi.com/2/files/get_metadata --header "Authorization: Bearer ********AuthorizationKey*********" --header "Content-Type: application/json" --data "{\"path\": \"/toratoratora/reports\", \"include_media_info\": true}"
{".tag": "folder", "name": "Reports", "path_lower": "/toratoratora/reports", "id": "id:******ID******", "shared_folder_id": "dbsfid:###dbsfid####", "sharing_info": {"read_only": false, "shared_folder_id": "dbsfid:****dbsfid****"}}
4) One thing that looks promising is "list_folder"
curl -X POST https://api.dropboxapi.com/2/files/list_folder \
--header "Authorization: Bearer ********AuthorizationKey*********" \
--header "Content-Type: application/json" \
--data "{\"path\": \"/toratoratora/reports\",\"recursive\": false,\"include_media_info\": true,\"include_deleted\": true}"
This lists all the individual files and their timestamps. However, since the timestamps are NOT returned for DELETED files, there's NO way to find when the file was deleted & hence the directory was last updated.
Does anybody have a solution for this problem?
Do the Python API (https://www.dropbox.com/developers/documentation/python) have better options?