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: 

Re: Issues with 2/files/list_folder/continue & cursor

Issues with 2/files/list_folder/continue & cursor

Victor L.19
Explorer | Level 4

I have a web app that does the following in order:

 

1. Login user via "login via dropbox" link

2. Get and save latest cursor

3. Call 2/files/list_folder/continue as needed using latest cursor, saving new cursor after api call

 

Now, no matter what changes are made to the app folder, *ALL* changes are returned when calling 2/files/list_folder/continue, not just latest changes.

 

Am i doing something wrong or out of sequence?

5 Replies 5

Greg-DB
Dropbox Staff
We'll be happy to help with this, but need some more information. Please reply with:

- the name and version of the platform and SDK/library you are using, if any
- the steps to reproduce the problem, including the relevant code snippet(s)
- the full text of any unexpected output/errors

Thanks in advance! If you'd prefer to share privately, please feel free to open a ticket here: https://www.dropbox.com/developers/contact

Victor L.19
Explorer | Level 4

Hi Greg,


Sorry for the lack of information.

 

I'm using PHP with no library (just CURL)

 

Snipper

 

$data = '{"cursor": "' . $cursor . '"}';
            
$ch = curl_init('https://api.dropboxapi.com/2/files/list_folder/continue');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token, 'Content-Type: application/json'));
$json = curl_exec($ch);
$result = json_decode($json, true);
        
$new_cursor = $result['cursor'];

There are no errors. However, the next time i call list_folder/continue with the new cursor, i get a history fo all changes previously. Not just recent changes.


Thoughts?

Greg-DB
Dropbox Staff
Thanks! I just tried this, and I can't seem to reproduce this issue with this code though.

Are you sure the first call is succeeding? I don't see any error handling in this snippet.

Also, how are you copying $new_cursor to $cursor? I don't see that in this sample either. Are you sure that's working properly?

Victor L.19
Explorer | Level 4
Hi Greg,

That's just a snippet in a class file. So essentially what im doing is this

1. Log user in, get latest cursor and save to database locally
2. Once a user makes changes, a webhook is sent and the locally stored cursor is used for the list_folder/continue call
3. Update cursor for user

Now when another change is initiated, making a call with the new cursor still shows ALL changes, not just latest.

I think i'm just using the wrong cursor, but need to confirm.

Should I..

Make API call then save cursor given by list_folder/continue

Or

Make list_folder/continue API call, then do another to get_latest_cursor and save that cursor.

Victor L.19
Explorer | Level 4
Disregard. I was not saving the latest cursor properly. I was using the wrong column name "user_id" vs "id" in the user table.

Sorry for the trouble and will add error handling asap.
Need more support?