Dropbox Http API - 获取当前令牌帐户的 files/folders

Dropbox Http API - get files/folders for current token's account

我正在尝试为批准我的应用程序的用户获取文件和文件夹(现在我在他批准后有了令牌)。

我能够通过获取用户 dbid 并将其与 "Dropbox-API-Select-User" header 一起使用来扫描团队中的所有用户,但有时我只想扫描当前用户(批准我的用户应用程序)。

我现在无法获得他的 dbid,当我尝试在没有 "Dropbox-API-Select-User" header 的情况下转到“https://api.dropboxapi.com/2/users/get_current_account”时,我收到一条消息说这个 header 丢失。

有什么想法我怎样才能在没有 dbid 的情况下找到他的 files/folders,或者以某种方式得到他的 dbid?也许在授权过程中不知何故?或其他 APIs?

我正在使用这个 API:https://www.dropbox.com/developers/documentation/http/documentation

我请求获取当前帐户:https://api.dropboxapi.com/2/users/get_current_account

我的 headers:

Content-Type:application/json

授权:不记名my_token

我收到此错误:调用 API 函数时出错 "users/get_current_account":缺少必需项 X-Dropbox-Perform-As-Team-Member header

谢谢。

Dropbox Business API 应用链接到整个团队,而不是任何个别团队成员。在这种情况下,除了您的应用通过 Dropbox-API-Select-UserX-Dropbox-Perform-As-Team-Member header 指定的内容之外,没有任何 "current user" 的概念。 Dropbox Business API 应用在使用用户端点时始终需要指定特定用户。您可以从业务 API 端点获取成员 ID,例如,使用 /team/members/list.

只有团队的管理员才能授权该应用程序,听起来您可能想要对碰巧授权该应用程序的团队中的特定管理员的帐户进行操作。 Dropbox Business API 没有 return 关于哪个管理员执行了授权的信息。此外,授权可能由多个管理员多次进行。

请注意,如果您想要对授权应用程序的特定用户执行API调用,您register并且应该使用正常Dropbox API 应用,而不是 Dropbox Business API 应用。 Dropbox API 应用仅链接到用户,而不是团队,并且不需要额外的 header 来指定团队成员。


编辑:

Dropbox API 现在提供了一种方法来确定哪个管理员授权了特定的访问令牌,使用 /team/token/get_authenticated_admin

如果你使用的是官方SDK,这个端点也会有相应的方法。