Autodesk-Forge / bim360appstore-model.derivative-nodejs-xls.exporter

BIM360 data to Excel: Let you export the Revit data, hosted on BIM360, into an Excel file
MIT License
23 stars 23 forks source link

413 error for big files. #16

Open libvarun opened 5 years ago

libvarun commented 5 years ago

If the file size is big and metadata is large, properties API is throwing '413 error' with message 'too large response'

augustogoncalves commented 5 years ago

if using Nodejs to make the requests, add the forceget options as described here. If on cliend-side (e.g. jQuery), just add the ?forceget=true querystring parameter

wallabyway commented 4 years ago

This happens with large Revit file with large metadata.

The core logic to export to Excel in this demo is available in the source code at: https://github.com/Autodesk-Forge/bim360appstore-model.derivative-nodejs-xls.exporter/blob/master/www/js/ForgeXLS.js

You can see, it calls the endpoint GET: Properties https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-properties-GET/

By default, this endpoint will only return the data if the properties data size is less 20M. If it is bigger than 20M, a header with forceget is required. This blog tells more: https://forge.autodesk.com/blog/forceget-options-get-properties but this sample code does not implement the header. So it might hang on due to large data.

To fix it Append this parameter when calling getHierarchy and getProperties. i.e. in the source code of this sample:

https://github.com/Autodesk-Forge/bim360appstore-model.derivative-nodejs-xls.exporter/blob/master/www/js/ForgeXLS.js#L55-L64

update to (note those two lines with the string in bold) getHierarchy: function (urn, guid, token, callback) { console.log('Downloading hierarchy...'); this.forgeGetRequest(this.Constants.BASE_URL + this.Constants.MODEL_DERIVATIVE_V2(urn) + urn + '/metadata/' + guid +'?forceget=true', token, callback); },

getProperties: function (urn, guid, token, callback) {
  console.log('Downloading properties...');
  this.forgeGetRequest(this.Constants.BASE_URL + this.Constants.MODEL_DERIVATIVE_V2(urn) + urn + '/metadata/' + guid + '**/properties?forceget=true**', token, callback);
}

},

augustogoncalves commented 4 years ago

@jaimerosales is working on a new version of this code wrapped as an extension.