cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

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

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

Greg-DB
Dropboxer
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

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

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?

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

Greg-DB
Dropboxer
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?

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

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.

Re: Issues with 2/files/list_folder/continue & 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.
Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Victor L.19 Explorer | Level 4
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?