How to Add File Reference to Quality Issue - autodesk-forge

Via the BIM360 API, I am able to create Quality Issues and upload files (to be used as attachments). However, even though I am calling Post Attachments (https://forge.autodesk.com/en/docs/bim360/v1/reference/http/field-issues-attachments-POST/) (and all responses are good), nothing appears on the Issue screen.
Issue screen with manually added file. How can I make my attached file appear under the References->Files section?
(Note, I saw a mention elsewhere of the relationships API, but I get a random error just calling the first "asset" API [{"title":"Forbidden","detail":"Forbidden","errorCode":"GENERAL_ERROR","type":"https://developer.api.autodesk.com/bim360/assets/v1/error-codes/GENERAL_ERROR"}])

firstly, the screenshot shows you are working with Issues in Autodesk Construction Cloud (ACC), while the API you are using is for BIM360 Issue. This API is NOT compatible with ACC.
To work with ACC Issue, the API is available at the category of ACC:
https://forge.autodesk.com/en/docs/acc/v1/reference/http/issues-issues-GET/
this blog tells more.
https://forge.autodesk.com/blog/acc-issues-api-available-preview
In the context of ACC, the attachment(references) is managed by the general API (Relationship API). In Additional Tests of Postman collection of ACC Issue API, I demoed how to add Photo with the Issue. The logic is similar.
https://github.com/Autodesk-Forge/forge-acc.issues.api-postman.collection
Firstly, use Data Management API to get the document urn. Then, use ACC Issue API to get id of one issue. finally, use Relationship API to bind them.
PUT https://developer.api.autodesk.com/bim360/relationship/v2/containers/{{project_id_without_b}}/relationships
P.s. -bim360- in the domains is just because of legacy design of the terminologies. It can work for the contexts of both BIM360 and ACC (note it is Relationship API can work within both of the contexts)
Payload:
[
{
"entities": [
{
"domain": "autodesk-bim360-issue",
"type": "issue",
"id": "{{one_issue_id}}"
},
{
"domain": "autodesk-bim360-documentmanagement",
"type": "documentlineage",
"id": "{{one_document_urn}}"
}
]
}
]

Related

ModelDeriviate's manifest is missing URN for SVF2

I know that it is possible to download the derivatives via their respective urns. However, the SVF2 object in the manifest doesn't contain its urn. Therefore, I cannot download the derivative as explained here or here. Is this not supported yet? And can I compute the urn from the data returned in the manifest?
Extract of an manifest example:
{
"urn": "SOME_URN",
"derivatives": [
{
"hasThumbnail": "true",
"children": [
{
"useAsDefault": true,
"role": "3d",
"hasThumbnail": "true",
"children": [
{
...
},
{
...
},
{
"role": "graphics",
"mime": "application/autodesk-svf2",
"guid": "SOME_GUID",
"type": "resource"
}
],
I'd like to make clear that it is possible to download the SVF2 'files' since your WEB browser can do it; therefore, you can access the data as well. The files are actually cached in your Browser, see below.
The Viewer downloads an extra manifest files (otg_model.json) which contains additional information. But downloading the 'files' on your local machine will not help since it requires a lot of setup to get the Viewer work properly with a local SVF2 storage. And with the current state of the technology, it is highly recommended you do not try to do this in production. When it comes to development, and debugging, I go a sample posted here which can help. But please be careful with the Autodesk EULA on doing offline workflows. This sample is a replacement of the old extract.autodesk.io sample as people were abusing of this website, and can work with both SVF and SVF2.
To answer the question in the comment section. SVF2 is still in beta, and access to the underlying data/files will probably be only available at the end on the beta. The main reason is that SVF2 and the Viewer code evolves too rapidly today to make a general availability to everything. So unless you keep updating them on your local machine, things may break, and therefore Autodesk is limiting the access.
Sorry for disappointing you, but ...
Unfortunately, it's expected behavior. SVF2 doesn't have a concept of URN, and you cannot download SVF2 for offline viewing at this moment since it's unsupported.

Phase Views in manifest after RVT model translation, how to detect or suppress?

We have a Revit model where we have configured a single 3D View in Publish Settings. We published that model to BIM 360 and are using Forge to extract the list of 3D Views.
We notice that after the model is translated, the only views available in BIM360 are the views included as set in the Publish Settings in Revit, irregardless of phase, but are under the Phases icon, when we extract the Views from the manifest we also get additional views that were created because some objects belong to different Phases. We don’t seem to be able to distinguish between the different views or see a relationship between different phases of the same view.
Is there a way to do that? or not to translate the additional phase views at all?
The extract below shows us the {3D} view and the Phase Views created “Existing” and “New Construction” using GET
https://developer.api.autodesk.com/modelderivative/v2/designdata/:urn/manifest
Manifest:
Those phased 3D views are from the mater view for each phase, you can suppress them by submitting translation jobs like below:
// POST https://developer.api.autodesk.com/modelderivative/v2/designdata/job
// with `x-ads-force: true` Reuest header
{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YWRuZGVtby9ob3VzZS5ydnQ"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
],
"advanced": {
"generateMasterViews": false
}
}
]
}
}
Note. The generateMasterViews option in BIM360 Docs is turned on by default and the translation job will be submitted automatically while the model was uploaded to Docs managed bucket successfully, currently.
Note 2. Triggering any translation jobs yourself on the models of the BIM360 Docs will consume extra Forge Cloud Credits. So, you have to use it carefully at your own risk.
Ref: https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/#body-structure

Unable to receive Forge webhooks, or unable to get them to fire

I'm setting up an automated system to convert and visualise 3D models through the Forge APIs. The actual conversion and visualisation is pretty straight forward, but keeping track of the process is not as simple.
Autodesk recommends using webhooks, but documentation of this is quite sparse.
My main problem is that I'm unable to debug the webhooks. I get no indication to weather a hook has been posted or not.
I've read all of the similar questions here on stack overflow, in the FAQ and in the documentation (among others: Why is webhook workflow not taken into consideration when creating modelderivative job?).
I'm processing a conversion for a model with 'modelId'. And want to listen to the events 'extraction.updated'.
I'm registering a hook with a POST like this:
{
"callbackUrl":"https://my-service.com/callbacks/modelId",
"scope":{
"workflow":"modelId"
}
}
My job is registered like this:
{
"input":{
"urn":"{theUrnForTheModel}"
},
"output":{
"formats":[
{
"type":"svf",
"views":[
"3d",
"2d"
]
}
]
},
"misc":{
"workflow":"modelId"
}
}
From what I can see the hooks never fire. I don't get any errors or indications that something fail on my server.
Am I required to post hookAttribute when creating the hook? This is documented as not mandatory. Am I required to have a fixes endpoint on my end, or is it ok to include the specific model id in the url?
A few points to check:
What's the response on POST hook? Should return 201
Which verb does your /callbacks/modelId accepts? Should accept POST
Have you tried extraction.finished event?

Monitoring progress of extraction job of file in a bucket?

I want to monitor the progress of an extraction job of a file stored in a bucket.
I've gone through the Webhooks API documentation, and if I understood everything correctly, the events only work for files stored in a folder, so it can't be used with a bucket. Please correct me if I'm wrong.
So, besides polling the GET :urn/manifest endpoint in the Model Derivate API, and assuming the Webhooks API can't be used with a bucket, is there any other way to monitor the progress of an extraction job?
Thanks.
Webhook now supports the Model Derivative event extraction.finished. This type is exactly used in the scenario of translating model of the bucket.
This is a blog on the API. I copied it as a reference on SO:
https://forge.autodesk.com/blog/introducing-webhook-model-derivative-api
Webhook now supports the Model Derivative event extraction.finished, so your app can be notified when translation job finishes.
To use it, (1) create a hook specifying a scope.workflow:
{
"callbackUrl": "http://bf067e05.ngrok.io/callback",
"scope": {
"workflow": "my-workflow-id"
}
}
And (2) when posting a translation job, specify the misc.workflow:
{
"input": {
"urn":
"dXJuOmFkc2sub2JqZWN0czpv...."
},
"output": {
"formats": [{
"type": "obj"
}]
},
"misc": {
"workflow": "my-workflow-id"
}
}
With my test, the workflow can be guid of your WebHook.The post body from Forge will tell you which file is translated and its urn, location etc.
Hope it helps.

Autodesk Forge BIM 360 API - Activating Service Types

We have been using the Forge API to automatically set up projects in BIM 360, but seem unable to find a way to automatically activate a Service (Field, Glue, etc.).
Intuitively, I would have thought that the "service_types" attribute would be the way to do this, but the services are not activating.
1) What does the "service_types" attribute actually do?
2) If possible, how do we activate a project Service using the Forge API (Most specifically Field)?
Thank you kindly,
Re. #1
Your understanding of service_type is correct.
Re. #2
Could you try below after you create a project?
https://developer.autodesk.com/en/docs/bim360/v1/reference/http/projects-project_id-users-POST/
e.g., with the body like this:
{
"role": "project_admin",
"service_type": "field",
"company_id": "77e4444e-5dad-46a2-ad29-555cc00452a0",
"email": "my.name#autodesk.com"
}
I verified that having service_type in project creation itself does not have effect. And the documentation is a little confusing. But if you use the above method, it works. Note that you need to have Field license with you account.
There is also a tutorial page:
https://developer.autodesk.com/en/docs/bim360/v1/tutorials/activate-service/