Forum Discussion

dcoffey's avatar
dcoffey
Explorer | Level 3
7 years ago

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: '' }

 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,948 PostsLatest Activity: 4 hours ago
351 Following

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 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!