hat means that 49 is a limit to the search in a folder and subfolders.
I want to list all Revit C4R models in a project, I was hoping to avoid traversing the whole project structure.
I was using the folder search endpoint, with this filter - 'filter[extension.type]': 'versions:autodesk.bim360:C4RModel'
starting with the 'Project Files' folder but it exceeded the 49 pages (or at least I think this is the issue as the error is 400 Bad request), so I was going inside the first level of sub folders and also it seems to exceed in some cases 49 pages.
I then looked at a different project and it seems that a page == result, i.e. if there are 4 files in a folder it will make 4 requests (first + 3 'next' page). Is that the case?
If it like that than I can either traverse the whole project folder structure, or build some search function that will go x levels down to search if a i exceed the 49 results.
Have I missed anything? Any thoughts/insights on how to tackle this limit?
page
represents a set of results. Each result page contains 200 results. Incase of folder search,without mentioning page[number]
query parameter, you will get first 200 items in the folder you are searching in.
If there are more than 200 items in the folder, you will usually see links
section in the API response that tells you self
, prev
and next
to indicate that there is more results.
Eg: below says I am in the 10th page(look at self
), the 9th page is in prev
and 11th page is next
.
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/{{projectId}}/folders/{{folderId}}/search?page%5Bnumber%5D=10"
},
"prev": {
"href": "https://developer.api.autodesk.com/data/v1/projects/{{projectId}}/folders/{{folderId}}/search?page%5Bnumber%5D=9"
},
"next": {
"href": "https://developer.api.autodesk.com/data/v1/projects/{{projectId}}/folders/{{folderId}}/search?page%5Bnumber%5D=11"
}
},
To retrieve results in page number 10
my GET query would simply look like this:
https://developer.api.autodesk.com/data/v1/projects/{{projectId}}/folders/{{folderId}}/search?page[number]=10
If a specific page number gives 400 Bad Request
error, it simply means that there is no content in the queried page number OR that you are searching beyond pageNumber 49. The API documentation suggests pageNumber can be 0 to 49 which is a limitation imposed by APS
So to query it better (narrow down the results) you might need to use the query parameter filter[extension]=.rvt
and/or search within a subfolder rather than parent level folder. You can also combine with comparison filters (eg: to filter files with last modified date in a given time range etc, so that your results have less than 49 pages of content)
Also you might find this more relevant: APS Data Management API Folder Search endpoint