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: 

Re: webhooks notification

webhooks notification

vineet
Explorer | Level 3
Go to solution

we have reviced the notification json format, but how can get actual file chnages.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

When you first store the access tokens and cursors in your app (e.g., in your database), you should record which Dropbox account ID each one belongs to. (For any given access token, you can use /2/users/get_current_account to check the account ID, which just needs to be done once each.)

 

Then, when you get the webhook notification, you can use the account ID to look up the corresponding access token and cursor.

View solution in original post

9 Replies 9

Greg-DB
Dropbox Staff
Go to solution

The webhook notification payload will tell you which account has had changes, so you can then use the corresponding access token for that account to call /2/files/list_folder[/continue] (or corresponding methods in whatever SDK/library you're using, if any) to see what exactly changed.

vineet
Explorer | Level 3
Go to solution

We are using from postman  https://api.dropboxapi.com/2/files/list_folder/get_latest_cursor 

 parameter 

{"path""","recursive"true,"include_media_info"false,"include_deleted"false,"include_has_explicit_shared_members"false,"include_mounted_folders"false,"include_non_downloadable_files"true}
 
response is getting 
{
    "cursor""AAEbjtW3suBBNRBPGmOMSPj69WGB4_TV4EkxUdP2r_W3uI4SuAsMX7tdrFy9UQ-s8ZC74h8HNo_0f6mGTXqx8zUA_gkjGsh9aZ7o6ch-wTbG-1eXrJtoMrXS5nkG2oIYFAhUxApWIpTB9OkiFewCgw3Ar5MgJRfZ6b2WuIhoJ5vYe8Txb-_N-sMapbzUh5DiZVhyoTeT-76BwIZX_7XEoAgr1CmnxA1HJQfqVpY9Fip5dA"
}
 
after the response API , we are using second API   https://api.dropboxapi.com/2/files/list_folder/continue for get the latest changes
request 
{"cursor""AAEbjtW3suBBNRBPGmOMSPj69WGB4_TV4EkxUdP2r_W3uI4SuAsMX7tdrFy9UQ-s8ZC74h8HNo_0f6mGTXqx8zUA_gkjGsh9aZ7o6ch-wTbG-1eXrJtoMrXS5nkG2oIYFAhUxApWIpTB9OkiFewCgw3Ar5MgJRfZ6b2WuIhoJ5vYe8Txb-_N-sMapbzUh5DiZVhyoTeT-76BwIZX_7XEoAgr1CmnxA1HJQfqVpY9Fip5dA"}
 
 
 
response
{
    "entries": [],
    "cursor""AAFtk_vDugrNpHMohiYXcyZi0NpVVlc79RjfB7M5Zu7zfI0DojtbSf3Yw8pah-oqBda83532H7G2GoEXP_e2UrWwvCaZAWcHysfkfuOll9sZntVn2TYMem84VMa_CQpKZMpyYvMFZwi3OMgnMtRUwZ_t1yRGAyPbuBf6P9NkuEpkf6Qzqbc-JRPvJwlip03iI18E-_NZmYcsuaRw6zpWvDyBTZCwKBvSwoa0c9C-bClHJhSe_G5AHLDw2O_nYyv9plM",
    "has_more"false
}
 
We have  change the folder name and file name  and munual file upload on dropbox , current get the reciving the  notification like this 
{"list_folder": {"accounts": ["dbid:AADsKehzrQqxnG4GnclQAYU2mU0ER_f9vOw"]}, "delta": {"users": [2399690544]}}
 
i am using current linked account access token form APP console,
 
did't get any latest chnages  file and folder after the hiting  https://api.dropboxapi.com/2/files/list_folder/continue did not get any resoonse everytime getting  response is empty like this 
{
    "entries": [],
    "cursor""AAFtk_vDugrNpHMohiYXcyZi0NpVVlc79RjfB7M5Zu7zfI0DojtbSf3Yw8pah-oqBda83532H7G2GoEXP_e2UrWwvCaZAWcHysfkfuOll9sZntVn2TYMem84VMa_CQpKZMpyYvMFZwi3OMgnMtRUwZ_t1yRGAyPbuBf6P9NkuEpkf6Qzqbc-JRPvJwlip03iI18E-_NZmYcsuaRw6zpWvDyBTZCwKBvSwoa0c9C-bClHJhSe_G5AHLDw2O_nYyv9plM",
    "has_more"false
}
 
 
please suggest me where i am worng
 
 
 
 
 
 

 

Greg-DB
Dropbox Staff
Go to solution

To clarify, are you calling /2/files/list_folder/get_latest_cursor before or after you received the webhook notification?

 

The order should look like this:

 

  1. Call /2/files/list_folder/get_latest_cursor to get the latest cursor for the account using the access token for the account and save the returned cursor.
  2. Make changes in the account.
  3. Receive the webhook notification from Dropbox for the account.
  4. Call /2/files/list_folder/continue using the cursor received in step 1 and the same access token.

vineet
Explorer | Level 3
Go to solution

Thnaks,  for the fast response 

 

i want to  ask question 
we have recived Cursor response from Get lateat cursor API  and save cursor data into database  and 

I have recived the notification and the save the notification json format into database 

 

How can get  User details from which API

 

{"list_folder": {"accounts": ["dbid:AADsKehzrQqxnG4GnclQAYU2mU0ER_f9vOw"]}, "delta": {"users": [2399690544]}}

 

please suggest me 

 

 

 

 

 

 

Greg-DB
Dropbox Staff
Go to solution

When you first store the access tokens and cursors in your app (e.g., in your database), you should record which Dropbox account ID each one belongs to. (For any given access token, you can use /2/users/get_current_account to check the account ID, which just needs to be done once each.)

 

Then, when you get the webhook notification, you can use the account ID to look up the corresponding access token and cursor.

vineet
Explorer | Level 3
Go to solution

Thanks for the response Greg

 

Can i use GetAccount API , i got the response dbId for reciving notification and pass the parameter dbId into GetAccount API  so getting the response for particular user???

 

???????

 

 

Greg-DB
Dropbox Staff
Go to solution

You can technically use /2/users/get_account to look up the account information for a particular account based on an account ID, but for the sake of efficiency I recommend instead recording the information initially as described in my previous comment.

RJ77
New member | Level 2
Go to solution

Followed the exact steps still getting entries=[]

Greg-DB
Dropbox Staff
Go to solution

@RJ77 The webhook notification indicates that the account has had changes somewhere in the account, so you can then use the corresponding access token for that account to call /2/files/list_folder[/continue] (or corresponding methods in whatever SDK/library you're using, if any) to see what exactly changed.

 

So, make sure you're using an access token for the correct account. Also, note that the calls to /2/files/list_folder[/continue] will be subject to the options you set (or their defaults, if you don't specifically set them) when calling /2/files/list_folder. Returned cursors retain those options. For example, if you set 'recursive=false' (or didn't set 'recursive'), and the changed item(s) were nested deeper than the 'path' you listed, you won't get those entries returned in the 'entries' list. You would need to set 'recursive=true' in that case to get those entries (or explicitly list the relevant parent folder). I recommend referring the documentation linked above as well as the File Access Guide and Detecting Changes Guide.

Need more support?