cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

To detect file changes for team

To detect file changes for team

jyyoon
Explorer | Level 3

I can detect file changes with /list_folder/longpoll and /list_folder/continue for a single user(not team)

 

Can I use /list_folder/longpoll for teams file? I want to use longpoll not /team_log/get_events.

 

I have no idea yet.

 

If I add  Authorization and Dropbox-API-Select-User http headers, I got a error below.

 

"Error in call to API function "files/list_folder/longpoll": Your request includes an Authorization header, but this function does not use it."

 

And how can I get a team member id if the account is not a admin of a team but just a member.

 

Can the member of the team use /token/get_authenticated_admin?

5 Replies 5

Greg-DB
Dropbox Staff

You can use the list_folder endpoints to list and detect changes to any files in an account, including files in team folders/spaces, as long as the app and connected account have access to the files. You can find more information on app permissions here. For access to shared areas, such as team folders/spaces, the app would need to use the "full Dropbox" access type (not the "app folder" access type).

 

The following guides may be helpful:

 

Regarding the "Your request includes an Authorization header, but this function does not use it" error you're seeing on /2/files/list_folder/longpoll in particular, that's because that endpoint expects "No Authentication", so you shouldn't supply an "Authorization" header. (The necessary information is embedded in the "cursor" value you supply.)

 

For other calls, if the app is linked only to a member's own account, not the entire team, you should not supply the "Dropbox-API-Select-User" header. That header is only needed when the app is connected to the entire team and the endpoint being used is a user endpoint, and so a specific member needs to be specified. You can find more information on this feature in the "Member file access" documentation.

 

And for reference, user-linked access tokens can't be used to call /2/team/token/get_authenticated_admin, as that's only accessible to and necessary for team-linked access tokens.

jyyoon
Explorer | Level 3

Then, how can I get changes of files in team folders of a team space?

 

I can access the folders and the files with a root name space, but the /list_folder/longpoll don't give me a notification of any changes of files in the team space.

 

 

Greg-DB
Dropbox Staff

The /2/files/list_folder/longpoll endpoint should notify you of changes relevant to whatever cursor you give it. So, as long as you call /2/files/list_folder[/continue] with the necessary "Dropbox-API-Path-Root"/parameters it will notify of relevant changes.

 

For example, if you originally called /2/files/list_folder with a "Dropbox-API-Path-Root" with a "root" for the team space, it will give you back a cursor. If you pass that cursor to /2/files/list_folder/longpoll, it should report changes for changes inside that team space.

 

If something doesn't seem to be working as expected though, feel free to share the relevant steps and code to reproduce the issue, and whatever unexpected error or output you're getting so we can look into it.

jyyoon
Explorer | Level 3

 

When I got a notification from longpoll using a cursor whicn I got from /list_folder, I tried to request /list_folder/continue with the cursur. The response was cursor reset error.

 

Which cursor should I use when requesting /list_folder/continue after longpoll?

 

And If I want to get notifications from 5 team folders, should I request 5 longpoll at the same time by thread?

 

 

Greg-DB
Dropbox Staff

The "changes" and "reset" responses are different conditions from different endpoints, so you'll need to implement handling for both of them. The "changes: true" response from /2/files/list_folder/longpoll just tells you when something has changed for the supplied cursor, so that you can go call /2/files/list_folder[/continue] to list the entries. You would generally use the same cursor you sent to /2/files/list_folder/longpoll when then calling /2/files/list_folder/continue, but this isn't strictly necessary. You can follow whatever procedure makes sense for your app.

 

Regardless of whether or not you're using /2/files/list_folder/longpoll, you should implement error handling for your implementation of calling /2/files/list_folder/continue. For instance, if you get back "reset" that means you need to relist the folder starting at /2/files/list_folder.

 

Anyway, yes, each /2/files/list_folder/longpoll call only takes one cursor, so you'll need to use /2/files/list_folder/longpoll as many times as you have distinct cursors (that is, distinct configurations of the original call to /2/files/list_folder) that you want to monitor. For instance, monitoring 5 cursors is fine, but since each one requires its own network connection, you wouldn't want to let that scale arbitrarily; you likely wouldn't want to fire off 1000 such requests simultaneously, for instance. For example, you can try to optimize this by monitoring a single parent folder instead of individual child folders, where possible.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    jyyoon Explorer | Level 3
What do Dropbox user levels mean?