node.jsautodesk-forgeautodesk-data-management

Fail to upload a document to BIM360/ACC with node


I am following the following step by step guide (https://aps.autodesk.com/en/docs/data/v2/tutorials/upload-file/) I am using node.js with axios package to do all the web requests. The response I get at step 6 seems to be ok (i get status 200 :) When I move to step 7 , I get an error stating :

errors: [
        {
          id: 'dcda72b1-04c2-441b-a928-aafbb1d32d39',
          status: '400',
          code: 'BAD_INPUT',
          title: 'Object violates schema "create_item".',
          detail: 'See meta section for details.'
        }
      ],

I think the issue has something to do with my translation of the cUrl command from the tutorial into Javascript and substituting the parameters I am missing something , how do I check this ? A console.log of the JSON.Stringify(data) output follows :

{"jsonapi":{"version":"1.0"},"data":{"type":"items","attributes":{"displayName":"testing.pdf","extension":{"type":"items:autodesk.core:File","version":"1.0"}},"relationships":{"tip":{"data":{"type":"versions","id":"1"}},"parent":{"data":{"type":"folders","id":"urn:adsk.wipprod:fs.folder:co.hRlS3cVYRhuXeBmzluk9Ug"}}}},"included":[{"type":"versions","id":"1","attributes":{"name":"testing.pdf","extension":{"type":"versions:autodesk.core:File","version":"1.0"}},"relationships":{"storage":{"data":{"type":"objects"}}}}]}

Any idea is welcome. thanks Jonathan


Solution

  • For uploading files to BIM360 or ACC, the item extension should be items:autodesk.bim360:File, not items:autodesk.core:File. and the version extension should be versions:autodesk.bim360:File, not versions:autodesk.core:File.

    ref: https://aps.autodesk.com/en/docs/bim360/v1/tutorials/document-management/upload-document-s3/