Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello,
I'm trying to get the thumbnail of an image with the js sdk implemented in a TypeScript application.
I'm using th method fileGetThumbnail() it return a Promise<DropboxTypes.files.FileMetaData> so once the promise is resolve I have an object of the type FileMetaData.
This is fine but the FileMetaData object does not have a fileBlob object in it but when I'm doing a console.log(response), I do have a fileBlob in it...
How am I supposed to get the thumbnail in my application without the blob ?
Thank you for any help
@bffy_smmmers The filesListFolder method doesn't return any file data or shared links. It only returns file metadata. The Dropbox API also doesn't return thumbnail links in general. If you want the original file data, you should call filesDownload. If you want a thumbnail of an image file, you should call filesGetThumbnail. Those return the requested data directly (via fileBlob or fileBinary), but not as a link.
@Greg-DB Thanks, and i am passing in the path to the file, correct? would that not mean the `path_lower` attribute? This does not yield any result for me. Here is my implementation. When i wrap it in a try/catch, i get the error (fetch is not a function) I apologize for not unerstanding, again, I'm new to this. Im trying to put my code in a block, but it gives me an error when i go to post.
async getThumbnail(path: any) {
console.log(`getThumbnail is running with ${path}`)
const data = await this.client.filesGetThumbnail(path)
console.log(<any>data)
//im returning an empty string so it doesnt break anything
return '';
}
@bffy_smmmers You should use .then and .catch to handle the result/error, like this:
dbx.filesGetThumbnail({path: path})
.then(function(response) {
console.log("got filesGetThumbnail response:");
console.log(response);
console.log("got thumbnail data:");
console.log(response.fileBlob);
})
.catch(function(error) {
console.log("got filesGetThumbnail error:");
console.log(error);
});
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!