Hi,
We're building an integration that tracks file changes across a Dropbox Business team using the team_log/get_events API. When a user deletes a folder, we receive a single file_delete event with assets[0][".tag"] = "folder", no individual events are generated for the files that were inside that folder.
Our problem:
We need to know which files were nested inside the deleted folder so we can update our local records accordingly. Without child file events, those records become stale/orphaned.
What we tried:
We attempted to call /2/files/list_folder on the deleted folder's path with include_deleted: true and recursive: true, hoping to retrieve DeletedMetadata entries for the children. We use Dropbox API Select User to act as the team member and Dropbox API Path Root with the folder's namespace ID.
POST https://api.dropboxapi.com/2/files/list_folder
Content-Type: application/json
Dropbox-API-Select-User: dbmid:XXXX
Dropbox-API-Path-Root: {".tag": "namespace_id", "namespace_id": "14322964035"}
{"path": "/test", "include_deleted": true, "recursive": true}
This returns 409 CONFLICT with path/not_found, which makes sense, because the folder no longer exists by the time our system processes the event.
We understand that include_deleted shows deleted entries within an existing folder, but it doesn't make a deleted folder path resolvable.
Our question:
Is there a recommended way to discover the files that were inside a folder at the time it was deleted? Specifically:
- Is there an API that can list the former contents of a deleted folder (or a folder that's been moved to trash)?
- Does team_log/get_events have a mode or filter that would return child file delete events when a folder is deleted?
- Would a different approach, such as maintaining a cursor with /files/list_folder/continue and using the delta entries, be the right pattern here?
- If there's no API to retrieve the nested files of a deleted folder, would the recommended approach be to maintain our own mapping of folders to their child files so we can resolve them locally when a folder delete event arrives?
We're using the Dropbox Business API with team-level admin scopes. Any guidance on the recommended pattern for this use case would be greatly appreciated.
Thanks! : )