6 May 2021

403 error when trying to view SVF2

Some people ran into a 403 error when trying to view the SVF2 of their models - see picture on top.

The issue is that the acmSessionId needs to be set for the options that you pass to loadModel()

If you are using loadDocumentNode(), which wraps loadModel(), then it will set that value for you, and using that function is the best way going forward.
That function too supports options as input, so have all the capabilities that calling loadModel() directly provides.

Just for completeness' sake, here is how you could avoid the error if you were to stick to calling loadModel() directly, but this might not work in all scenarios:

function onDocumentLoadSuccess(doc) {
    let items = doc.getRoot().search({
        'type': 'geometry',
        'role': '3d'
    }, true)

    let url = doc.getViewablePath(items[0])
    viewer.loadModel(url, { acmSessionId: doc.getAcmSessionId(url) })



Related Article

Posted By

Adam Nagy

Follow @AdamTheNagy Adam Nagy joined Autodesk back in 2005 and has been providing programming support, consulting, training and evangelism to external developers. He started his career in Budapest, then worked in Prague for 3 years and now lives in South England, UK. At the moment focusing on Inventor and Fusion 360, plus cloud and mobile related technologies. Adam has a degree in Software Engineering and has...