How to create a Design Automation workitem with a composite design Revit file with nested references - autodesk-forge

Given the following situation, where "->" is a Xref reference in either overlay or attachment mode:
TOPHOST.rvt -> LINKA.rvt -> LINKA1.rvt
I know that I can use .../:version_id/relationships/refs to retrieve references from TOPHOST.rvt, which includes the reference to LINKA.rvt.
I can repeat this with a query for LINKA.rvt, which will return the reference to LINKA1.rvt.
This way, I can gather all information necessary to create a workitem for design automation, following this guide on how to include links (see "Host RVT file with linked models").
This works for versions that are not marked as isCompositeDesign (not documented in versions/:version_id, but isCompositeDesign is a key in attributes.extension.data with boolean values). For these versions, the .../:version_id/relationships/refs API will return empty data, ie. no references!
This is a huge problem, as in active projects, items are isCompositeDesign=true most of the time.
How can I get the reference information necessary to create a Design Automation workitem in scenarios with composite designs?

Update Apr. 28, 2023
It seems related to one known issue FDM-3977. I will update here once our engineering team gets back.
====================
If your target version urn shows that it's a composite design in its attributes.extension.data.isCompositeDesign like this one, according to Why an RVT model is (sometimes) downloaded as ZIP from BIM 360, then you should get a ZIP file that contains the host and all linked RVTs while downloading the host RVT file via GET buckets/wip.dm.prod/objects/XXXX.rvt. Isn't it what you want?
{
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.UTLEaKw?version=4",
"attributes": {
"name": "test.rvt",
"displayName": "test.rvt",
//...
"versionNumber": 4,
"mimeType": "application/vnd.autodesk.r360",
"storageSize": 111297725,
"fileType": "rvt",
"extension": {
"type": "versions:autodesk.bim360:C4RModel",
"version": "1.1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:C4RModel-1.1.0"
},
"data": {
"modelVersion": 3,
"isCompositeDesign": true,
"mimeType": "application/vnd.autodesk.r360",
"compositeParentFile": "test.rvt",
//..
"modelType": "multiuser",
//..
"processState": "PROCESSING_COMPLETE",
"extractionState": "SUCCESS",
"splittingState": "NOT_SPLIT",
"reviewState": "NOT_IN_REVIEW",
"revisionDisplayLabel": "4",
"sourceFileName": "test.rvt",
"conformingStatus": "NONE"
}
}
},
"relationships": {
//...
"storage": {
"data": {
"type": "objects",
"id": "urn:adsk.objects:os.object:wip.dm.prod/XXXX.rvt"
},
"meta": {
"link": {
"href": "https://developer.api.autodesk.com/oss/v2/buckets/wip.dm.prod/objects/XXXX.rvt"
}
}
}
}
}

Related

Fiware Upload Image

I want to know how to use NSGI-LD to upload an image even though these static files are not stored in Orion Context Broker or Mongo. I want to know if there is a way to configure the NSGI-LD to forward the images to AWS S3 Buck or another location?
As you correctly identified, binary files are not a good candidate for context data, and should not be held directly within a context broker. The usual paradigm would be as follows:
Imagine you have a number plate reader library linked to Kurento and wish to store the images of vehicles as they pass. In this case the event from the media stream should cause two separate actions:
Upload the raw image to a storage server
Upsert the context data to the context broker including an attribute holding the URI of the stored image.
Doing things this way means you can confirm that the image is safely stored, and then send the following:
{
"vehicle_registration_number": {
"type": "Property",
"value": "X123RPD"
},
"image_download": {
"type": "Property",
"value": "http://example.com/url/to/image"
}
}
The alternative would be to simply include some link back to the source file somehow as metadata:
{
"vehicle_registration_number": {
"type": "Property",
"value": "X123RPD",
"origin": {
"type": "Property",
"value": "file://localimage"
}
}
}
Then if you have a registration on vehicle_registration_number which somehow links back to the server with the original file, it could upload the image after the context broker has been updated (and then do another upsert)
Option one is simpler. Option two would make more sense if the registration is narrower. For example, only upload images of VRNs for cars whose speed attribute is greater than 70 km/h.
Ontologically you could say that Device has a relationship to a Photograph which would mean that Device could have an additional latestRecord attribute:
{
"latestRecord": {
"type": "Relationship",
"object": "urn:ngsi-ld:CatalogueRecordDCAT-AP:0001"
},
}
And and create a separate entity holding the details of the Photograph itself using a standard data model such as CatalogueRecordDCAT-AP which is defined here. Attributes such as source and sourceMetadata help define the location of the raw file.
{
"id": "urn:ngsi-ld:CatalogueRecordDCAT-AP:0001",
"type": "CatalogueRecordDCAT-AP",
"dateCreated": "2020-11-02T21:25:54Z",
"dateModified": "2021-07-02T18:37:55Z",
"description": "Speeding Ticket",
"dataProvider": "European open data portal",
"location": {
"type": "Point",
"coordinates": [
36.633152,
-85.183315
]
},
"address": {
"streetAddress": "2, rue Mercier",
"addressLocality": "Luxembourg",
"addressRegion": "Luxembourg",
"addressCountry": "Luxembourg",
"postalCode": "2985",
"postOfficeBoxNumber": ""
},
"areaServed": "European Union and beyond",
"primaryTopic": "Public administration",
"modificationDate": "2021-07-02T18:37:55Z",
"applicationProfile": "DCAT Application profile for data portals in Europe",
"changeType": "First version",
"source": "http://example.com/url/to/image"
"sourceMetadata": {"type" :"jpeg", "height" : 100, "width": 100},
"#context": [
"https://smartdatamodels.org/context.jsonld"
]
}

Retrieving "Description" or "Custom Attribute" fields using Autodesk Forge API

We are trying to retrieve the description or custom attribute field as shown in BIM360 Docs using Autodesk Forge API requests/commands.
We have tried the following requests to retrieve information about a specific file:
https://forge.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-GET/
https://forge.autodesk.com/en/docs/data/v2/reference/http/ListItems/
We get a lot of information/data about our files, but we cannot see the Description field neither a Custom Attribute in the responses that we are getting.
"data": {
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.WKuhlYuyR8uK2WT8HE1bCQ?version=20",
"attributes": {
"name": "TESTING",
"displayName": "TESTING",
"createTime": "2019-07-29T09:37:33.0000000Z",
"createUserId": "*****",
"createUserName": "TESTING",
"lastModifiedTime": "2019-08-05T08:27:10.0000000Z",
"lastModifiedUserId": "*****",
"lastModifiedUserName": "TESTING",
"versionNumber": 20,
"storageSize": 27020,
"fileType": "xlsx",
"extension": {
"type": "versions:autodesk.bim360:File",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.bim360:File-1.0"
},
"data": {
"processState": "PROCESSING_COMPLETE",
"extractionState": "UNSUPPORTED",
"splittingState": "NOT_SPLIT",
"revisionDisplayLabel": "20",
"sourceFileName": "TESTING"
}
}
},
...
}
Among all of these fields, we expected the fields "Description" or "Custom Attributes" to appear as well (As they are shown in BIM360 DOCS). ¿Is it possible to retrive these fields using API requests?
At the moment it is not possible to retrieve Custom Attribute information from BIM 360 Docs, But a new API is under development and in Private Beta testing at the moment to get this information back, Please check back with us in a near future since this will become available soon. Thank you for understanding.

Is there any data returned from the Forge Data Management Search api to indicate a model is deleted?

When using GET projects/:project_id/folders/:folder_id/search, Forge Data Management API on a model with a deleted last version, is there a any information in the "attributes" or other returned data that indicates the file is deleted?
Currently, a second call to GET projects/:project_id/items/:item_id/versions is used to determine if the latest version is deleted (below) but it would be preferable to not call another request to get this information.
Returned JSON from /versions (with some data removed):
"data": [{
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.w0cwXPUwQziKIHtKBtYRaA?version=3",
"attributes": {
"versionNumber": 3,
"extension": {
"type": "versions:autodesk.core:Deleted",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.core:Deleted-1.0"
},
"data": {
"originalName": "**.rvt"
}
}
}]
The json attribute.hidden = true seems to indicate deleted. This can be accessed via the filter[hidden] = true. I'm closing this as the correct answer.

Access files located in the WIP folder of BIM360 Design (old C4R)

We have a requirement from one of our clients to access the project files that are stored in the BIM360 Design (old Collaboration for Revit - C4R). I can not find any information in the developer pages of the Forge APIs that points to this location. I assume such an API is not part of Forge, but we were wondering if there is any other API that can provide those files.
The exact requirements are:
Constantly monitor for changes on the files located there.
When changes occur, retrieve and backup all those files to a local machine.
The question is, how, if possible, can we access the project files located at the BIM360 Design cloud?
UPDATE (10/04/2018)
We have found these commands - specifically PublishModel and GetPublishModelJob. This does something, we can at the very least prompt the publication on demand, without the need for Revit. It is not clear to me when the items:autodesk.bim360:C4RModel pseudo-file is created. On top of that, the API does not appear to be able to receive a prefered output folder, which makes it really cumbersome to work for the intended purpose of backing up the information inside BIM360 Design.
UPDATE (25/04/2018)
We have tried using both commands (PublishJob and GetPublishModelJob). We have impersonated a Project Admin (via the x-user-id) but Forge is returning a 401 error (which is not even documented). The following (with a redacted documentID) is what we have tried:
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "commands",
"attributes": {
"extension": {
"type": "commands:autodesk.bim360:C4RModelGetPublishJob",
"version": "1.0.0"
}
},
"relationships": {
"resources": {
"data": [ { "type": "items", "id": "<document_id>" } ]
}
}
}
}
And this is Forge's response:
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a4547153-1fd4-4710-b0d1-a7184d9e7e22",
"status": "401",
"code": "C4R",
"detail": "Failed to get publish model job"
}
]
}
Any thoughts?
After discussing with #tfrascaroli in Forge Help channel, we found the root cause of this error is caused by the incorrect value of x-user-id, so he didn't have the right permission to push the latest version of the C4R model to BIM360 docs.
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "a4547153-1fd4-4710-b0d1-a7184d9e7e22",
"status": "401",
"code": "C4R",
"detail": "Failed to get publish model job"
}
]
}
The x-user-id is not a GUID and not the id we saw in the response of GET users or GET users/:user_id, it should be the value of the uid. After replacing the x-user-id value by the uid, the error doesn't show up again.
[
{
"id": "a75e8769-621e-40b6-a524-0cffdd2f784e", //!<<< We didn't use it for `x-user-id`
"account_id": "9dbb160e-b904-458b-bc5c-ed184687592d",
"status": "active",
"role": "account_admin",
"company_id": "28e4e819-8ab2-432c-b3fb-3a94b53a91cd",
"company_name": "Autodesk",
"last_sign_in": "2016-04-05T07:27:20.858Z",
"email": "john.smith#mail.com",
"name": "John Smith",
"nickname": "Johnny",
"first_name": "John",
"last_name": "Smith",
"uid": "L9EBJKCGCXBB", //!<<<<< Here is the value for the x-user-id
"image_url": "http://static-dc.autodesk.net/etc/designs/v201412151200/autodesk/adsk-design/images/autodesk_header_logo_140x23.png",
"address_line_1": "The Fifth Avenue",
"address_line_2": "#301",
"city": "New York",
"postal_code": "10011",
"state_or_province": "New York",
"country": "United States",
"phone": "(634)329-2353",
"company": "Autodesk",
"job_title": "Software Developer",
"industry": "IT",
"about_me": "Nothing here",
"created_at": "2015-06-26T14:47:39.458Z",
"updated_at": "2016-04-07T07:15:29.261Z"
}
]
Do you have an access right to the workshared Revit file? Publish command is to publish workshared central model in the cloud to Docs. To use it, you need an access to Revit model in the central in the cloud. Forge Publish command does the same thing as publish command in Revit desktop. You need the same access right. To use cloud workshared feature, first you need to have Design license assigned to you, then you also need to be a member a Revit project. Being invited to Docs is not enough.
(As C4R/Design was merged to Docs recently, this C4R specific license part was intentionally kept the same as previous licensing. We also have Team for earlier versions. It makes it a bit complicated. I hope it will be easier as we move forward in future.)

Autodesk Forge Data Manager Api rename a Item

I'm tried to use this PATCH Api to rename item of "A360".
It returns 200 with DisplayName updated, but on myhub.autodesk360.com the item seems rendered with "Name" property of json object "Included".
this is the request body :
{
"jsonApi": {
"version": "1.0"
},
"data": {
"id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
"type": "items",
"attributes": {
"displayName": "new_item",
"name" : "new_item"
}
}
this is the response :
"data": {
"type": "items",
"id": "urn:adsk.wipprod:dm.lineage:tMqu2aQEToa3XsRmKzTTRg",
"attributes": {
"displayName": "new_item",
"createTime": "2017-10-25T09:04:35.0000000Z",
"createUserId": "QY23PAJ2YB4G",
"createUserName": "bot#autodesk360.com",
"lastModifiedTime": "2017-11-30T09:00:46.0000000Z",
"lastModifiedUserId": "AYLNNU3UK324",
"lastModifiedUserName": "Giuseppe Signorelli",
"hidden": false,
"extension": {
"type": "items:autodesk.core:File",
"version": "1.0",
"schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/items:autodesk.core:File-1.0"},
"data": {}
}
}
and object included :
"included": [ {
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.tMqu2aQEToa3XsRmKzTTRg?version=2",
"attributes": {
"name": "House Design.rvt",
"displayName": "House Design.rvt",
"createTime": "2017-11-09T16:50:30.0000000Z",
"createUserId": "AYLNNU3UK324",
"createUserName": "gsignorelli#tierratelematics.com",
"lastModifiedTime": "2017-11-09T16:50:34.0000000Z",
"lastModifiedUserId": "",
"lastModifiedUserName": "",
"versionNumber": 2,
"mimeType": "application/vnd.autodesk.revit",
"storageSize": 12550144,
"fileType": "rvt",
"extension": {
"type": "versions:autodesk.core:File",
"version": "1.0",
"schema": {"href": "https://developer.api.autodesk.com/schema/v1/versions/versions:autodesk.core:File-1.0"},
"data": {}
}
}
I expected that on my client show same result that A360 shows.
If I understand correctly, you are trying to use PATCH API to rename the item name of BIM360 Docs, right? As far as I know, currently, PATCH APIs are only working on A360, they are not currently supported or encouraged for BIM 360 Docs. There might be a chance that allows for a folder rename, but it does not properly update the Docs database. So we do not recommend to use that APIs for BIM 360 Docs, and if you want to change a file name, I suggest you to upload a new version instead.
If you want to update the file name in A360, you should use PATCH API to a version, not an item. Here is what I tried, and the name of the file version is updated correctly:
PATCH API to update the name of the version, the trick thing is that you need to URL encode the version id in the endpoint, you can use any tools like https://meyerweb.com/eric/tools/dencoder/ to do that. This is different as the PATCH API to item.
Once you get the 200 status, your file name should be updated correctly in A360 as shown in the following picture: