Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
webrobert
3 years agoExplorer | Level 3
getting changes after Webhook
Hello devs,
I am having an issue getting changes to files [after changing to a business account]
Before I was using the `files/list_folder` endpoint.
But now I can't seem to get ...
- 3 years ago
Hi webrobert,
First of all, using list_folder alone, will never get the changes alone! Is this ever worked (on any account type)? I don't think so.
You need to keep the last cursor cached and when some change comes in, you can "continue" with changes only. 😉
webrobert wrote:...
I am having an issue getting changes to files [after changing to a business account]
...
Did you set your root namespace? 🤔 I can't see such things in the code you posted. Account root space and the home space coincide for personal account and for team account without spaces, but are different things when you're using team spaces. If not set explicitly, the home space is in use.
Hope this gives direction.
webrobert
3 years agoExplorer | Level 3
@Здравко, legend. Thank you. Root name space. did it.
Yes, cache and go. Here is my Laravel solution using listFolderContinue() to retrieve or create a cache of the cursor.
public function listFolderContinue()
{
$cursor = cache()->rememberForever('dropbox_stores_cursor', function () {
return $this->listFolder()['cursor'];
});
$response = Http::withToken(cache()->get('dropbox_token'))
->withHeaders([
'Dropbox-API-Select-Admin' => '<member_id>',
'Dropbox-API-Path-Root' => '{".tag": "root", "root": "<id_of_root>"}'
])
->post('https://api.dropboxapi.com/2/files/list_folder/continue', compact('cursor'))
->json();
if ($response['cursor']) {
cache()->put('dropbox_stores_cursor', $response['cursor']);
}
return $response;
}
public function listFolder()
{
return Http::withToken(cache()->get('dropbox_token'))
->withHeaders([
'Dropbox-API-Select-Admin' => '<member_id>',
'Dropbox-API-Path-Root' => '{".tag": "root", "root": "<id_of_root>"}'
])
->post('https://api.dropboxapi.com/2/files/list_folder', [
'include_deleted' => true,
'include_has_explicit_shared_members' => false,
'include_non_downloadable_files' => false,
'path' => '/Stores',
'recursive' => true
])
->json();
}
Greg-DB
Dropbox Community Moderator
3 years agoFor reference for anyone looking for information on setting the root, please refer to the Team Files Guide.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!