Why are my searches using autodesk forge data management api unreliable - autodesk-forge

I am using the search DataManagement API in autodesk forge to test for an item's existence before creating it (or creating a new version)
This is fine most of the time but the search fails on certain files even though they are clearly visible in the ACC web interface.
The API calls look like
https://developer.api.autodesk.com/data/v1/projects/:projectId/folders/:folderId/search?filter[attribute.name]=[my item's name]
https://developer.api.autodesk.com/data/v1/projects/:projectId/folders/:folderId/search?filter[attribute.displayName]=[my item's name]&page[number]=1
I have tried searching on different attributes such as attribute.displayName.
I have tried paging through the data using the next links.
I have tried using the contains qualifier
It seems some files cannot be "found" with this search API?

Related

Autodesk forge: Listing files and getting recent

I've been looking through the Autodesk Forge API a bit but I have not found a way to do the following things:
Query/list files in a whole Fusion 360 team hub, filtering on e. g. filename.
Get a list of the N most recently accessed files (created, opened, saved)
Is this possible? So far I've seen that is possible through recursion, but I want to avoid making a lot of API calls.
Query/list files in a whole Fusion 360 team hub, filtering on e. g. filename.
This can be done using the search endpoint. It traverses all subfolders recursively, and can filter based on different criteria (see https://forge.autodesk.com/en/docs/data/v2/developers_guide/filtering/). I believe it can be used at a project level.
Get a list of the N most recently accessed files (created, opened, saved)
I'm afraid this kind of sorting is not available using these endpoints.

How do I show the issue ids corresponding to all the issues in a file?

I am trying to show the issue ids corresponding to all the issues that are present in a drawing file. Currently, the issue ids are shown only when the issue is clicked. Is there a way to achieve the same using Forge development?
Yes, you can list issue IDs attached to a specific document using Forge APIs like so:
Use Data Management APIs to find the URN of a specific version of your document
the URN should start with something like urn:adsk.wipprod:dm.lineage:
Use BIM360 APIs to list all issues available in your BIM360 project, and if needed, filter them based on their target_urn property with the URN you found in the previous step

Listing model files in BIM360 through data management API

I have a need to display models stored in BIM360 in the Forge Viewer. For this reason I'd like to list all models that are contained in a project.
I was looking at fetching them using the search API. Is this a reasonable way to do it? I guess the only way to identify model files is to use attributes.fileType in the filter? And then look at the relationships.derivatives data. Or is there some other way to search for models?
Unfortunately, your request is not supported by the Search API currently. With my experience, extracting relationships.derivatives out is the only way manually from the API responses that contain this attribute e.g.
GET projects/:project_id/folders/:folder_id/contents
GET projects/:project_id/items/:item_id/tip
GET projects/:project_id/items/:item_id/versions

Can model derivative get all the information from BIM?

I'm very new to forge and revit. I've been trying to see if I can get all the information from Revit / BIM file programmatically. I know I might be able to get it with DB link or excel, but export to excel seems an extract steps.
Then I found out Forge, I was assuming Model Derivative APIs will did the job for you, basically upload the files to bucket and click on the models to select object, let's say a floor, I should be able to make API calls with all the information about that floor. However, when I play around with Forge, it seems like not every information is in the properties. Is that correct? Or I just didn't implement it correctly?
Thanks for your answer.
It is possible to get all the information regarding properties of any/all object(s).
First you need to get the URN of the version of the file, get the metadata from this API:
https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET/
Use the next 2 APIs in the above link to get properties of any/all object(s).
In case you don't know how to get URN:
The way you get URN is from forge Data Management Api, you can list Hubs > Projects > Folders > Items > Versions.
This tutorial guides you on the steps.

Autodesk ObjectId and ElementId in dwg

I am use to develop one web app using Forge API. It's working well and good. At the same time am using design automation in forge. I can able to create Package and it's working fine.
I will process the dwg file using forge api preparing to viewer. I can able to view dwg in browser.
My issue is I have viewer click event the event click populate the element id. However, my package I can get only the object id. element id and object id totally different.
What is the conman id each object client and server side.
Summary: when user click the object in viewer I want to capture id and store my local database. and using package I need to process the user clicked object.
Example: when user click the drawing number in viewer. From the next time I want change the drawing number dynamically using call package from C# code.
For an RVT file, one easy way to handle this is to extract the Forge externalId from the Forge object properties. That is equal to the Revit element UniqueId property. The RvtMetaProp Revit add-in makes use of this.
Oh, now I just found a better, more complete and succinct explanation of Unique IDs for Forge Viewer Elements:
The Viewer gives access to three types of IDs when dealing with Revit files:
dbId: this is viewer specific and used to manipulate elements within the viewer, such as for the .getProperties() method.
Revit ElementID: exposed as part of the Name property in the viewer. When you select something, the Property panel title is in the form of 'Name [12345]'. You can parse this name string and extract the element id.
Revit UniqueID: exposed as the externalId property in the .getProperty() response.