Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
kennyli_floqast
1 year agoExplorer | Level 3
How do i get the relative path for a folder?
My app is integrated with dropbox. However, I see some changes coming for business team dropbox: https://help.dropbox.com/plans/upcoming-business-team-changes?_camp=16203&_tk=banner_campaign_format#...
Greg-DB
Dropbox Community Moderator
1 year agoApps using the Dropbox API should continue using the same API methods/endpoints, such as filesListFolder and filesListFolderContinue, and the same properties such as path_lower or path_display, however you may need to make some changes, such as to start using the “Dropbox-API-Path-Root” header to make sure you're accessing the desired content. For instance, using the “Dropbox-API-Path-Root” header is necessary in order to access the contents of a team space.
Please read the following resources for information on how to use the API to interact with a team space:
kennyli_floqast
1 year agoExplorer | Level 3
Thanks! My code originally worked with team space but seems like they're rolling out changes. Not sure whats wrong with my existing code (I am already setting path-root). Does it have to be empty?
/**
* @param {Authorization} authorization
*/
function createDropboxInstance(authorization) {
const dropboxOptions = {
accessToken: authorization.access_token,
};
if (authorization.rootNamespaceId) {
Object.assign(dropboxOptions, {
pathRoot: JSON.stringify({
'.tag': 'root',
root: `${authorization.rootNamespaceId}`,
}),
});
}
return new DropboxSDK.Dropbox(dropboxOptions);
}
async fetchFilesAndFolders(storage, authorization) {
const dropboxSDKInstance = createDropboxInstance(authorization);
const folderMetadata = await this._folderInfoInternal(
storage,
authorization
);
return new Promise((resolve, reject) => {
const retryCallback = makeRetryCallback(resolve, reject);
retry(
Dropbox.retryOptions,
(callback) => {
dropboxSDKInstance
// @ts-ignore
.filesListFolder({ path: folderMetadata.path_display })
.then((response) => callback(null, response))
.catch((error) => {
this._logger.error(
formatLoggerErrors(
error,
'fetchFilesAndFolders'
)
);
this._logger.error(error);
callback(
StorageProviderError(
this.name,
error.status ? error.status : 500,
1005,
error.error
)
);
});
},
retryCallback,
this._logger
);
});
}
- Greg-DB1 year ago
Dropbox Community Moderator
There are a number of ways to use the functionality, depending on what you're trying to do, but the pathRoot field, if being used, should not be empty. In order to access the team space, for instance, you should use the root mode and use the root namespace ID for the connected account.
To clarify, is something in particular currently not working as expected? Please feel free to share the specific error/unexpected output and I'll be happy to take a look.
Note that if you need a test team, you can request one using the process described under the "How do I test my application?" question here. Be sure to indicate what specifically you need to test.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!