bim360appstore-model.derivative-nodejs-xls.exporter icon indicating copy to clipboard operation
bim360appstore-model.derivative-nodejs-xls.exporter copied to clipboard

413 error for big files.

Open libvarun opened this issue 7 years ago • 3 comments

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

libvarun avatar Oct 15 '18 12:10 libvarun

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

augustogoncalves avatar Oct 18 '18 14:10 augustogoncalves

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);
}

},

wallabyway avatar Apr 02 '20 16:04 wallabyway

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

augustogoncalves avatar Apr 02 '20 16:04 augustogoncalves