Autodesk forge: Listing files and getting recent - autodesk-forge

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.

Related

Why are my searches using autodesk forge data management api unreliable

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?

How to distinguish BIM 360 vs ACC/unified projects?

(Update: There may or may not be any such thing as a "unified project". But there is definitely a button on my Account Admin->Projects screen that says "Go to unified projects", hence my confusion. It just takes me to a list of all projects.)
Since some API endpoints are not compatible between the two types of projects, (see https://forge.autodesk.com/en/docs/acc/v1/overview/bim-360-compatibility/compatibility-table/), it would be nice to know, programmatically, which type of project you are dealing with.
The response from https://developer.api.autodesk.com/hq/v1/accounts/:hub_id/projects lists, for example, the exact same details regardless. Is there another call that would give more info?
I know that the BIM 360 projects start with "b.", but not in the above list.
Just poking around, the BIM 360 API endpoint https://developer.api.autodesk.com/hq/v1/accounts/:account_id/projects apparently returns only(?) BIM 360 projects, complete with "b.". But if I want ALL projects, and simply need to know the difference? I could make both calls and parse the differences; but one call with the correct info would be great, if it exists.
The endpoint I meant is: https://forge.autodesk.com/en/docs/data/v2/reference/http/hubs-hub_id-projects-GET/. It is for project information in the general context. The one you pointed out is for getting project information in the context of BIM360.
Data Management is a general API. e.g. you manage your (as a web application) manage models and data in your own buckets (on Forge), this goes with Data Management. BIM360 or ACC or Fusion360 etc is the platform that manages model or data for end users, in a format of more user-orientated structure like hub>>project>>folder>>item>>version etc. These fall into Data Management. BIM 360 API will be more specific in the context of BIM360. e.g. Admin API (like what you are using), Issue API, RFI API, Cost API , Model Coordination API etc.
As to united project, it means the project list managed within Autodesk Construction Cloud (ACC), which includes BIM360 projects and ACC projects. In another word, a united portal to access the two types of projects. To distinguish the two types, the attribute I mentioned in the last email is the indicator. Hope it explains.

Search for project in Forge BIM 360 API

We have over 3000 projects in our BIM 360 account and need to be able to search for a specific project by name. Currently we are using the GET projects endpoint in the Forge BIM 360 API to create a list of projects and querying the list to find the project. This was working well for a while, but due to a limit of 100 projects returned by the endpoint we have to make multiple calls using the offset parameter. With 3000 projects this requires 30 requests, and we are starting to see a performance hit in some of our applications, which will only get worse over time as we add more projects. Is there a way to call the GET projects endpoint with a filter on project name?
I believe you can call /project/v1/hubs/:hub_id/projects with page[limit]=200, but unfortunate we don't have a filter by name.

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.

google drive api partial search results

I am using Google Drive API from Google App engine for java. I am searching the google docs with search string
Files.List request = service.files().list().setQ("title contains 'Donation'");
It returns only 2 files with title DonationThankYouLetterData and How to Create Awareness on Blood Donation
I failed to understand why it is not returning other files with title like
DonationThankYou_Anil Kumar _02-Aug-2013
Donation
All files are created by me so owner is same.
It could be a number of reasons...
Is there a nextPage link that you should be following. Drive doesn't guarantee to return all hits in a single response
Do you have the correct scope to access the file. Eg. if the first two files were created by your app, and the third was created in Drive, and your app only has drive.file scope.
To investigate further, you should ...
Go to https://developers.google.com/drive/v2/reference/files/get and retrieve the item for each file. Compare them to see if there is any obvious difference
Run the list without the query to confirm that all three files are indeed being returned
Also look at this answer Drive API files.list query with 'not' parameter returns empty pages which seems to suggest that "contains" is broken, but that doesn't seem to match your symptoms, based on the file names you used in your question.