Update File Version With Autodesk Api
Solution 1:
Your payloads are correct. To create the second version, you have to send your request to the CreateVersion endpoint.
url = '{}data/v1/projects/{}/versions'.format(self.DOMAIN, project_id)
Solution 2:
You must be missing a little detail that makes it not working, but since you provide so little description nobody can tell based on that ... In order to create a new version, you first need to create a new storage location, upload the file to that location, and post a new version, referencing the existing item id.
Alternatively take a look my that node js sample to upload a file and create a new item or version if the item exists.
Solution 3:
The data for your updating the version seems incorrect to me, Try the following steps.
- Create a new Storage location on the same folder where V1 of your file is located
- upload v2 of your file to the new storage location created on the step below.
- Get the item ID of the resource from the manifest result of your successful upload of V1 or call the following end point to obtain the ID https://developer.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-folders-folder_id-contents-GET
Once you have all this information your data to pass in will look like this.
{"jsonapi":{"version":"1.0"},"data":{"type":"versions","attributes":{"name":"v2File.rvt","extension":{"type":"versions:autodesk.bim360:File","version":"1.0"}},"relationships":{"item":{"data":{"type":"items","id":"urn:adsk.wipprod:dm.lineage:8jehs1iSQGu_wXpZ977bjA"}},"storage":{"data":{"type":"objects","id":"urn:adsk.objects:os.object:wip.dm.prod/a7fde689-62cf-49c1-9273-8df976568996.rvt"}}}}}
The only difference I can think of is your objectId is not correct. Image below is proof of both versions uploaded with the API.
Post a Comment for "Update File Version With Autodesk Api"