0

I am trying to attach a photo via the Forge API to an issue like it does in BIM 360 when drag and drop files into the Attachments tab.

I tried to create a bucket, upload a file there and attach the uploaded file with "urnType" = "oss" using a POST request for attachments. But it crashes with 403 code at attacment post.

1 Answers1

0

Try to follow this tutorial : Attach BIM360 Files

The urnType should be "dm" in the POST request

EDIT :

If you want to upload pictures and be able to see it, you can use "oss" for the urnType but instead of using the urn of the picture from folderContents endpoint ex : urn:adsk.wip:dm.lineage:... use the objectId in the response of the upload ex : urn:adsk.objects:os.object:wip.dm.prod/xxxx-xxxx-xxxx-xx.png

Then if you check the attachment details you'll get attachment-type:"photo" instead of "document" and be able to see the thumbnail in the issue details.

I tried it and it worked for me (and you have one step less in the process of adding pictures attachment )

AlexAR
  • 1,052
  • 1
  • 9
  • 15
  • I am currently using this variant. It is not suitable as the files will not appear in the "Photos" section. Also, I would like the files to be as hidden as when dragging and dropping files into BIM 360. – Ramir Gimaltdinov Sep 21 '21 at 11:31
  • I edited my answer with a way to get the "photo" attachment type. However I don't know how to hide files on BIM360. Maybe we can add a "hidden" property but I never tested it. – AlexAR Sep 21 '21 at 12:59
  • It really helps. If do not create a version, then it seems like the file cannot be found in Ducument Management. So maybe this will be my solution of the problem. Thanks for the help. – Ramir Gimaltdinov Sep 21 '21 at 15:08
  • Yes, you still need to create the file version. For the hidden folder, you can `PATCH` your picture folder using this endpoint : https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-folders-folder_id-PATCH/. You need to add the `attribute -> "hidden" : true` – AlexAR Sep 21 '21 at 15:10