1. A+国际艺术教育
2. 嘉德艺术教育
3. 瀚墨书画艺术留学
4. 枫丹白露艺术留学
5. 天艺艺术教育
6. 美行思远艺术留学
7. 艾迪留学
8. 新东方前途出国
9. 金吉列留学
10. 威久留学
Get a Thumbnail
This sample demonstrates how to get a thumbnail of a version of a document.
Prerequisites
Before running this sample, you must first:
Have a Forge account and [create an app]().
Set up [TwoLegged Authentication]() to use with the Forge API.
Have a BIM 360 account and obtain a [Personal Access Token]().
Know the document ID.
Know the version ID.
Know the size of the thumbnail you want to retrieve, you can choose between 20x20, 40x40, 50x50, 70x70, 100x100, 120x120, 150x150, 180x180, 200x200, 220x220, 250x250, 300x300.
Running the sample
1. Clone this repo: `git clone
2. Run `cd All_Samples/Samples_REST_API/Thumbnails/`
3. Run `npm install` to install the required node modules.
4. Run `node index.js` to execute the sample.
Sample code
typescript
const request = require('request');
// Replace with values for your project
const DOCUMENT_ID = 'YOUR_DOCUMENT_ID';
const VERSION_ID = 'YOUR_VERSION_ID';
const SIZE = 'YOUR_THUMBNAIL_SIZE'; // 20x20, 40x40, 50x50, 70x70, 100x100, 120x120, 150x150, 180x180, 200x200, 220x220, 250x250, 300x300
const access_token = 'YOUR_BIM360_ACCESS_TOKEN';
const options = {
url: + DOCUMENT_ID + '/versions/' + VERSION_ID + '/thumbnail?size=' + SIZE,
headers: {
'Authorization': 'Bearer ' + access_token,
'AcceptEncoding': 'base64',
},
method: 'GET',
};
request(options, (err, res, body) => {
if (err) {
console.error('Failed:', err);
return;
}
const thumbnail = body;
console.log('Thumbnail base64: ', thumbnail);
});