We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
dcoffey
8 years agoExplorer | Level 3
JavaScript filesGetThumbnailBatch() returns success, no thumbnails. Anyone have example code?
I am using NodeJS and trying to get batches of thumbnails in groups of (up to) 25 using the API function filesGetThumbnailBatch(arg)
I am getting a successful result and an array of responses, but the "thumbnail" value is an empty string.
If I make a call for a single thumbnail using
filesGetThumbnail(arg)
I get back a result which has a key of "fileBinary" included which contains a buffer with the image data.
fileBinary: <Buffer ff d8...
I know that the endpoints are different, a single image is a "content-download" endpoint and the batch endpoint is an "RPC", but the RPC docs state that results are returned in JSON. What am I doing wrong to batch get the thumbnails? Anyone able to share some sample code? More info below:
Sample code:
// get thumbnails for the current batch of files
var thumbs = await dbx.filesGetThumbnailBatch({
entries: files.entries.map(function(entry){
return {
path: entry.id,
format : {'.tag': 'jpeg'},
size: { '.tag': 'w2048h1536'},
mode: { '.tag': 'strict' }
}
})
});
Sample Output of successful call to
filesGetThumbnailBatch(arg)
but lacking thumbnails in results:
{ entries:
ocv2-server | [ { '.tag': 'success', metadata: [Object], thumbnail: '' },
ocv2-server | { '.tag': 'success', metadata: [Object], thumbnail: '' },
ocv2-server | { '.tag': 'success', metadata: [Object], thumbnail: '' },
ocv2-server | { '.tag': 'success', metadata: [Object], thumbnail: '' },
ocv2-server | { '.tag': 'success', metadata: [Object], thumbnail: '' },
ocv2-server | { '.tag': 'success', metadata: [Object], thumbnail: '' },
ocv2-server | { '.tag': 'success', metadata: [Object], thumbnail: '' } ] }
console output of a single item within the results of
{ '.tag': 'success',
ocv2-server | metadata:
ocv2-server | { name: '03_march_2017-2166.jpg',
ocv2-server | path_lower: '/<path-here>/03_march_2017-2166.jpg',
ocv2-server | path_display: '/<path-here>/03_march_2017-2166.jpg',
ocv2-server | parent_shared_folder_id: '1405518608',
ocv2-server | id: 'id:ivylSwty9kAAAAAAAAABng',
ocv2-server | client_modified: '2017-03-16T03:35:12Z',
ocv2-server | server_modified: '2017-03-16T03:37:11Z',
ocv2-server | rev: 'af53c809b0',
ocv2-server | size: 10792733,
ocv2-server | media_info: [Object],
ocv2-server | sharing_info: [Object],
ocv2-server | content_hash: 'e8320ea5b7295fed9ebaecf4b61789322b0e2ab3f17922675979d5bd6ab5f778' },
ocv2-server | thumbnail: '' }
9 Replies
- Greg-DB8 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/51434434/dropbox-api-filesgetthumbnailbatch-returns-successful-but-no-thumbnails-return ]
Thanks for the report! You don't appear to be doing anything wrong. The 'thumbnail' can be empty, e.g., if the corresponding file is empty. That doesn't seem to be the case here though, so we'll need to look into it.
I just tried this myself though, and it worked for me. (I.e., 'thumbnail' was not empty.) Would you be able to supply a sample file that this issue reproduces with? (E.g., the '03_march_2017-2166.jpg' file, or whatever you're comfortable sharing.) You can also open an API ticket if you'd prefer to share privately. Thanks in advance!
- dcoffey8 years agoExplorer | Level 3
Hi Greg, thanks for the support!
Here are the images I was using as a sample set for the batch request:
https://www.dropbox.com/sh/qxr4id51pn1s7yf/AAC92AF8NyaluTrmimRgKNQna?dl=0
They are all about 12MB each, so not over the 25MB limit. I am able to get them if I request them individually.
Let me know if I should also open a ticket.
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! That's helpful. We're looking into it. - Greg-DB8 years ago
Dropbox Community Moderator
Thanks for your patience here. I tried reproducing this with the same files, and it actually worked for me. Can you try again and let me know if you're still seeing the issue now? It's possible it was just a transient issue. Thanks in advance! - dcoffey8 years agoExplorer | Level 3
Hi Greg,
Thanks for letting me know, I came back to re-implement batchGet (current version gets thumbs individually - works) but batchGet gave me the same result of empty String for a thumbnail, I event tried new photos:
{ entries: ocv2 | [ { '.tag': 'success', metadata: [Object], thumbnail: '' }, ocv2 | { '.tag': 'success', metadata: [Object], thumbnail: '' }, ocv2 | { '.tag': 'success', metadata: [Object], thumbnail: '' }, ocv2 | { '.tag': 'success', metadata: [Object], thumbnail: '' }, ocv2 | { '.tag': 'success', metadata: [Object], thumbnail: '' }, ocv2 | { '.tag': 'success', metadata: [Object], thumbnail: '' } ] }https://www.dropbox.com/sh/82gmq8wt8w28pea/AABgbkJMxDf_LPVONIQ4YYcea?dl=0
Same code as before:
// get thumbnails for the current batch of files var thumbs = await dbx.filesGetThumbnailBatch({ entries: files.entries.map(function(entry){ return { path: entry.id, format : {'.tag': 'jpeg'}, size: { '.tag': 'w2048h1536'}, mode: { '.tag': 'strict' } } }) });Not sure what is going wrong here, happy to try and debug here or in a ticket. Let me know what works.
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! We'll keep investigating. I'll let you know if there's anything else that would be helpful. - Greg-DB8 years ago
Dropbox Community Moderator
Thanks for your patience while we investigate this. We're still working on tracking down exactly where/how this breaks down.
We have determined though that this is not actually about the files themselves, but rather about how they're being specified. I.e., this only occurs when specifying the files via file ID, so as a workaround for now, please switch to specifying the file path instead. - Greg-DB8 years ago
Dropbox Community Moderator
This shoud be fixed now. You should be able to specify the files using their IDs again now and get back the thumbnails. Please let me know if you're still seeing any issues.
- dcoffey7 years agoExplorer | Level 3
Sorry for the very belated reply on my end. I can confirm this is working!
About Dropbox API Support & Feedback
Find help with the Dropbox API from 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!