cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Webhooks notifications

Webhooks notifications

Victor V.3
Explorer | Level 3

Hi Dropbox Community, 

I am working on a java app, which is integrating with the dropbox api. I managed to upload, move, delete files without any problems. Now, I am trying to use webhooks for my app. Here are some details to have some context about what I am trying to achieve. 

I have a dedicated dropbox account which is linked to my app [through this setup -> https://www.dropbox.com/developers/apps] and this account has access in our dropbox storage only to a specific folder. I want dropbox to notify my app, when files are added or deleted inside this folder. Reading through your documentation [https://www.dropbox.com/developers/reference/webhooks#tutorial], there are some details that I don't fully understand, and I could use some assistance if possible. So here are my questions:

1. JSON notification format: What is the meaning of the accounts element ? I read in another post on this forum that, each dbid:xxx.xxxx  is user specific, but what does it mean exactly ?

2. JSON notification format: What is the connection between the dbid and user id from the users element. 

3. Redis: In the docs it is mentioned that "we're keeping track of each user's OAuth access token and their latest cursor in Redis". Should I know the OAuth access token in advance, and store them separately in Redis, or this is something I should do based on the notification sent by Dbx webhook? If so, how can I do that ? Is it using the dbid ? 

4. Pythod example: I'm not super familiar with python, but looking at your sample code in the doc page, it seems that after the notification is received, you are using the account elements and for each account you call the files_list_continue? Do you need the user ids at all ?

Thanks in advance for your time. 

-victor

 

 

 

 

2 Replies 2

Greg-DB
Dropbox Staff

1. The accounts array tells you which accounts have changes. Each "dbid:" string is account-specific. It's the account ID for a particular account, as used by API v2, e.g., as returned by /2/users/get_current_account.

2. The integer user ID format is used by API v1, and the "dbid:" format is used by API v2. So, if your app is built on API v1, you would check the delta.users value to determine which users have had changes. If your app is built on API v2, you would check list_folder.accounts. The intent is that your app would then call the relevant API endpoint to get information on the changes, e.g., /1/delta for API v1, or /2/sharing/list_folders/continue for API v2.

3. In order to make an API call for a particular user account, you need to have an access token for that account. Your app receives an access token for an account when the user authorizes the app to access their account. Your app should then store those access tokens for future use. In your case, you're only connecting to a single account (your own) so you'll only have one access token anyway.

4. The process_user method in the sample uses the account ID to look up the corresponding access token. That sample uses API v2, so it only needs the account ID format ("dbid:"), not the user ID format.

Victor V.3
Explorer | Level 3

Hi Gregory,

Thanks a lot for your quick answer. Now everything is clear, after understanding the meaning of the accounts vs users. I think this is an important detail which could be mentioned in the webhooks tutorial (v1 vs v2). However, it's my bad as well for not doing my homework better :). I am using api v1 indeed, so I will be using the users ids list and /1/delta.
 
Thanks again, 
Have a nice day, 
-victor
Need more support?
Who's talking

Top contributors to this post

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