Uploading a file to storage location - autodesk-forge

I'm getting stuck on uploading a file via the data management API to a BIM 360 storage location, specifically the last step I've been following the step by step guide on the forge site here and saw an answer here however using postman copying and pasting it gets stuck on the final step "update the version of the file" every other step returns correctly however the last one gives me an error 400 BAD_INPUT response, not sure how to format the code and response so i just hosted it here
any help will be appreciated thank you!

I just tested with the BIM360 storage location, and it works good to me, there are a couple of issues you may need to keep in mind as follow:
Since you are using BIM360 hub, so when you try to create the first version of the uploaded file as you described, please use the correct extension type in the POST body, for BIM360, should be items:autodesk.bim360:File and versions:autodesk.bim360:File as follow:
When you try to create a storage under a folder using POST projects/:project_id/storage, in the POST body, you need to specify the folder, please make sure to use the correct folder that allow types of "items:autodesk.bim360:File", for example, the following folder is the root folder of my project, and it only allow the folder of "folders:autodesk.bim360:Folder", if you create a storage under this folder, you will get 403 forbid error.
But this folder should be Ok:

Related

ACM check Failed while download file from BIM#60 using Forge app

When i try to download a file from BIM360 using Forge application, I am getting the following error.enter image description here
Data Management and Assets services are enabled in BIM360. I have the admin permission for project specified.
I had the same issue but managed to solve it by realizing that the bucketId (wip.dm.prod) that I used to download the file was not constant but did actually depend on the storage on ACC/BIM360 (wip.dm.prod, or wip.dm.emea.2, etc.).
Retrieving the exact bucketId for the given file to download (accessible from the href variable in the storage metadata) did the trick.
Hope it can help someone.

Autodesk Forge - Post Jobs - Must files be in buckets and proper URN

I am working on doing a post job and I am confused about where files need to be to run the job and the proper urn.
The examples all use a file that the user uploads to a bucket. I am trying to run the post job on a file that a user has created in Fusion 360 and that he has selected through a GUI I created. The urn in question is obtained by letting the user select the hub, project, folder(s), and file. I then use this file urn on the post job.
I keep getting back the response of :
Failed to download the design description for the input design.
My questions are:
Is it possible to do this from a users hub or do all items have to be in buckets?
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
I took the "urn:" off the front of the urn and got a different error, which I believe meant that it couldn't find any file.
Invalid 'design' parameter.
So, it looks like the urn I am using is finding a file but there is an issue somewhere that is preventing that file from being accessed or translated or something.
I keep getting back the response of : Failed to download the design description for the input design.
For Fusion 360 files make sure the extension name of the object is f2d/f3d. BTW Forge Viewer support these two formats directly so you don't have to translate to SVF for Viewer to visualize them.
Is it possible to do this from a users hub or do all items have to be in buckets?
For hub project items use the Data Management API to obtain the object ID - be sure to include the version parameter in your URN - see GET projects/:project_id/folders/:folder_id/contents and use the id of the item as your URN as well as tutorial here to help you understand how project folder items work.
Where are those translated files stored once created? If I want to get data like volume and mass without storing the translated file, is that possible?
The translated derivatives would be stored separately and you can access them through the derivative manifest. Use GET :urn/metadata/:guid/properties to query derivative properties but you will need to translate the model (to any format will do) in order to extract properties - see tutorial here.

show linked files in autodesk forge viewer

i am trying to make auto-desk forge viewer.
using this link Forge & ASP.NET: from zero to hero in 30 minutes
and it works fine with single revit file.
now i want to view revit document that has linked document and i found this post How to Set References with Revit Files for View and Data API
but i think it is an old version of api.
so i don't know how to apply these steps in the viewer code.
any help
A zipped file which is contained the host RVT file and corresponding linked files can help you archive this goal. After uploading this ZIP file to the Forge DM, you have to make sure that ‘compressedUrn: true’ and ‘rootFilename: {your host RVT filename with the sub filename .rvt}’ your input field of the job configuration body while submitting your translation job. Please refer here for the details: https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
Some more info:
If you do not want to manage the reference, while simply count on Forge detects the reference automatically, the choice is what Eason mentioned: package all files in an zip, upload, and ask Forge Post Job service to translate the zip. You only need to specify the root file.
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
This blog tells more:
https://forge.autodesk.com/cloud_and_mobile/2016/07/translate-referenced-files-by-derivative-api.html
If you want to manage the reference, e.g. in one time, you have uploaded all files of one version or only a few files of the package. While after some time, some files need to be updated, or are not referred anymore, but it is unnecessary to upload all related files again (as in #1, upload zip again).
In such scenario, the choice is, firstly, set reference manually by another Forge service (Set Reference):
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-references-POST/
next, ask POST Job service to translate:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/
As of 1/2020 Autodesk has said that they do not support reference endpoint when exporting to SVG so zip file is the only supported method currenty.

Uploading a file to the plans folder in BIM360Docs

I'm new to using the data management API to gain access to BIM360Docs, I've successfully downloaded a file from any folder and I can upload to the project files folder, however the issue lies with uploading to the plans folder, all the API calls seem happy and appears to work, but when I check the actual BIM360Docs website it's not there, when I use the API call to display a folders contents it is there, so it appears to be uploading correctly yet isn't visible for some reason?
Here it is being uploaded successfully:
Here it is being visible using the get folder contents API call but not in docs:
So it is there and I can download it and everything is hunky dory I just can't see it on the website.
PS I'm using the step by step guide on the forge site (I'm unable to link as I don't have enough rep).
Can you tell me to what folder location are you uploading? I'm thinking maybe you are not posting the file to the right location, and that is why you can download it only. In that sense you are correctly creating the storage location, the problem is you are probably uploading your file to the wrong folder. Something I can suggest is the following, get a list of all the available folder within the root folder.
// Get Folder
curl -X GET -H "Authorization: Bearer YOURTOKEN" "https://developer.api.autodesk.com/data/v1/projects/BIM360ACCOUNTID/folders/urn%3Aadsk.wipprod%3Afs.folder%3AYOURROOTFOLDER/contents"
This will give you back a response JSON of all the folder within your Doc Project. Find the ID of the Plans Folder and continue with the following steps using that folder identifier.
//Step 3: Create a storage location
//Step 4: Upload a file to the storage location
//Step 5: Create the first version of the uploaded file
If everything goes correctly you should be able to see your plans in that location now. Please let me know how everything goes with this. Also check that you have the right Scopes setup in your token that the following ones are included scope= account:read account:write
Also that you have the right permissions within your Docs project to upload.

Updating JSON files in an ionic app

I am creating an Ionic app and there are few json files in the www/dataFiles folder. I need to package these files with the app. However, once installed on a device these json files need to be updated periodically with new data from a server. I was searching for days trying to figure out how to do it and I found out that files in the www folder cannot be rewritten. I have no clue how to move forward. Do I have to save files in a different location? I would really appreciate if you can point me in the right direction.
Thank you in advance.
You can not modify files on an already installed app.
Why not pull this data from a web service? Instead of storing the data on separate .json files, get that same json data from the server as a request and you will always have fresh data from the server.
What are you using as a server/database? With this information I can put you in the right path.