autodesk-model-derivative 401 Invalid authorization header - autodesk-forge

I am trying to use autodesk's model derivative api to read metadata of revit files. To do so, it needs to convert revit file to svf format. I'm trying to use https://developer.api.autodesk.com/modelderivative/v2/designdata/job endpoint to do so following official example here https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/extract-metadata-from-source-file/. I used same authorization header for creating bucket, uploading file. It has data:creat, data:read, data:write.
So I'm not sure why it didn't work for the job endpoint. Is this because I don't have access to model derivative apis?

Please make sure that Model Derivative API is enabled for your Forge app on the My Apps website

It turns out that urn should be objectid which also includes the file name.

Related

BIM Metadata Extraction - Automation - Using AWS S3 bucket and Autodesk Forge Model Derivative API

We are trying to implement an automation workflow as described below. Please let me know if it is possible to implement or not.
The workflow is going to be like this.
A user uploaded the Revit model to the AWS S3 bucket
2)The Autodesk Forge model derivative API automatically fetches that model from the AWS S3 bucket
The model derivative API then extracts the metadata from the translated model and exports the metadata into an SQLite or JSON format and saves back that database file into the same AWS S3 bucket.
This is feasible. you may combine a couple of services of AWS. I had similar practice long time ago. Probably it could be a reference
https://forge.autodesk.com/blog/2-legged-workflow-model-translation-part-1
https://forge.autodesk.com/blog/2-legged-workflow-model-translation-part-2
Note: some usage of AWS services may have changed. Forge side, the endpoints (using SDK) may be still working, but you also need to double test adjust if anything is tuned.

Fetch Metadata of a model using model derivative api (Forge)

I was trying some hands on with forge services, I want to fetch few object's properties inside of a revit model uploaded on bim360/ACC, for which I am calling two API's 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' for translating the job to svf and then calling API "https://developer.api.autodesk.com/modelderivative/v2/designdata/" + urn + "/metadata/" (with urn of the translated job) (failed when passed urn of revit file directly)
Can we not directly get the metadata/properties without converting the file to svf? Since translating to svf is taking a lot of time for large files, my motive is to decrease the time to fetch the properties, can you share any solutions if you think of any please?
Yes, you are correct in assuming that you need to translate to SVF in order to access any BIM element properties at all. It's either that, or open it in desktop Revit and access the data there. Also discussed in the Revit API discussion forum thread on fetching metadata of a model using Forge model derivative API.

Autodesk forge viewer

So we are using the forge viewer API, but when we upload file it doesn't show on the viewer and we end up with a gray viewer.
The file transcription to svf seems to not be working properly.
Anyone experience or know how to solve this?
First you need to check if your file is well uploaded in your bucket (I assume that your using Buckets/Object with 2-legged OAuth).
Using this endpoint your must see your uploaded files : Get Objects
In the response, you will find the objectId. This objectId need to be converted into base64 and URL Safe for the SVF translation.
Now, following this tutorial, you will be able to translate your file : Translate to SVF
Please note the response of this request to get the most information about this job.
Finally, check the manifest to know when the translation is complete.

How to expose azure managed api openapi v3 yaml file via REST link

I'm having trouble exposing a link to download an open API v3 spec from my managed API. I've seen this blog stating:
Export of OpenAPI Specification v3 files in the JSON and YAML formats in the azure portal and the developer portal, as well as through the REST API (YAML only).
However, clicking on this link as you can see shows a 404.
all I could see through the following blog page is that
You can also export the specifications through the visual interface of the Azure portal or a REST API call, with the format query parameter set to openAPI-link.
I'm unaware of the context of where this call is made (against our API endpoint??). any assistance is appreciated.
I've tried https://my.api.endpoint.com?format=openapi-link with no luck)
{
"statusCode": 404,
"message": "Resource not found"
}
Any suggestions?
If you want to export api from Azure API managemnt,we can use the following API to do that. It will export the Api Definition in OpenAPI 3.0 Specification as YAML document to Storage Blob. Then we can download the file from the blob
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?format=openapi-link
&export=true&api-version=2019-12-01
For more details, please refer to here

Can I get the URL of a translated DWG and use it as the input for a Design Automation Activity?

I have translated some DWG files into SVFs using the Model Derivative API. I kept track of the returned URNS and I'm able to view each translated file in the Forge viewer.
Since I used a persistent retention policy, those original DWG files are apparently stored somewhere in the Forge cloud.
Now, I want to run CAD scripts on one of those stored DWG files using the Design Automation API and send the output to some other cloud storage (Dropbox etc).
Is there a way to get the URL for one of those original DWGs based on the URN of its translated SVF and then use that URL as the input to a Design Automation Activity?
The short answer is Yes, you can use the file that uploaded to Autodesk storage as an input of Design Automation, just input the file link and access token.
We are about to release the Design Automation V3, so I use that version for example, but the way applies to V2.
You have 2 ways to use the link of your DWG file:
Use the file link directly with access token, when you upload your file to Autodesk storage or list all the content from on bucket, you should get the location property, and use that url with access directly as input url.
You can also create a signed URL for the original link to be used as input/output, for details, please refer Sign URL and Post workitem.
Here is one of my sample workitem request body, it includes both ways:
{
"activityId":"{{dasNickName}}.FileUpgraderActivity+prod",
"arguments":{
"rvtFile":{
"url":"https://developer.api.autodesk.com/oss/v2/buckets/revitiosample/objects/RevitNative.rvt",
"Headers":{
"Authorization":"Bearer {{dataApiToken}}"
}
},
"resultrvt":{
"verb":"put",
"url":"https://developer.api.autodesk.com/oss/v2/signedresources/***-****?region=US"
}
}
}