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

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.)

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"
]
}

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

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"
}
}
}
}
}

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.

Set Updated by when uploading files to BIM360 Docs with 2-legged authentification

I am building a tool automatically scan a local folder and upload files to BIM360 Docs, with 2 legged authentification, so far files can already uploaded to BIM360 Docs using Forge Data Management API however the "updated by" field is empty. what i want to accomplish is load the current login user and set the current user's name as updated by.
I cannot find anywhere i can use from Forge API to set the "updated by", can anyone suggest?
Thanks a lot.
When you post/patch an item/version there are two fields you can specify that suit your needs - lastModifiedUserId and lastModifiedUserName:
"attributes": {
"mimeType": "appplication/pdf",
"displayName": "version-test.pdf",
"name": "version-test.pdf",
"extension": {
"data": {
"tempUrn": null,
"storageType": "OSS",
"properties": {},
"storageUrn": "urn:adsk.objects:os.object:wip.dm.prod/3c8f6bbc-fe5c-4815-a92e-8b8635e7b1cb.pdf"
},
"version": "1.0",
"type": "versions:autodesk.bim360:FileVersions",
"schema": {
"href": "/schema/v1/versions/versions%3Aautodesk.bim360%3AFileVersions-1.0"
}
},
"createUserName": "John Doe",
"createTime": "2016-04-01T11:09:03.000Z",
"createUserId": "BW9RM76WZBGL",
"lastModifiedUserName": "John Doe",
"lastModifiedUserId": "BW9RM76WZBGL",
"versionNumber": 2,
"lastModifiedTime": "2016-04-01T11:11:18.000Z"
},
"type": "versions",
"id": "urn:adsk.wipprod:fs.file:vf.d34fdsg3g?version=2",
"links": {
"self": {
"href": "/data/v1/projects/b.6f8813fe-31a7-4440-bc63-d8ca97c856b4/versions/urn%3Aadsk.wipprod%3Afs.file%3Avf.b909RzMKR4mhc3O7UBY_8g%3Fversion%3D1"
}
}
Normally, we would suggest you to use 3 legged token to modify a file in BIM360 Docs, because that will keep track the users who made the modification to that file(updated by). Yes you can also use 2 legged token for file management in BIM360 for now, but this behaviour may change in the future, and we will clearly mention in our blog if it happens.
There is no user information for any changes to the BIM360 files with 2 legged token, but there is one way, follow the Upload Files to BIM 360 Document Managemen Tutorial, in Step 7 & 8, add the x-user-id parameter in the header as the following picture, you will see the last modified user is filled.
Check this https://forge.autodesk.com/en/docs/bim360/v1/reference/http/users-GET/ if you want to know how to get the x-user-id information, should be uid(Autodesk ID).

How to Move/Rename a file in TFS Source Control 2015, using the REST API?

I am trying to move files on our internal TFS using Python and the TFS REST API; the server appears to only support the API up-to version 2, but on MSDN I cannot find any docs for versions below v4.1.
The URL I'm posting to is https://<server>/tfs/<Collection>/<Project>/_apis/tfvc/changesets
Currently my best guess at the correct JSON body for the post request looks like this:
{
"comment": "moved file",
"changes": [{
"changeType": "rename",
"item": {
"path": "<filepath>",
"version": 468,
"sourceServerItem": "<filepath>"
}
}]
}
But i cannot get further than an HTTp error 400 bad request with the following message
{
"$id": "1",
"innerException": null,
"message": "Exactly one value for PathActions is required.\r\nParameter name: change.SourceServerItem",
"typeName": "System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"typeKey": "ArgumentException",
"errorCode": 0,
"eventId": 0
}
And for the life of me i cannot find any reference to PathActions on google, that is not for git instead of tfvc, or a correct way of providing a value for this item.
Does anybody have a way of renaming/moving files on a TFVC via a HTTP request?
It just occurred to me to do a rename using the TFS web interface and peek at the request sent by the browser.
Turns out this is the correct format:
{
"comment": "Moved File",
"changes": [
{
"changeType": 8,
"sourceServerItem": "<old path>",
"item": {
"path": "<new path>",
"version": 470
}
}
]
}