Skip to main content

Hello,


I'm looking for a way to optimize a box-folder tree walker with the minimum number of api calls. The main objective of the walker is to detect only new or recently modified folders in a large folder structure (~10k of subfolders) so that I can skip unchanged folders with respect to a given date; however, within the current box-python-sdk, I need to call `get()` for every subfolders to check `modified_at`.


This is quite inefficient and takes a lot of time. Imagine only 1 subfolder is modified among 10k. The walker still needs to scan all 10k subfolders. I thought about using `Client.search().query()` but this idea also has two main obstacles:


  1. parent folder (depth 1) cannot be specified

  2. query cannot be empty

Any input would be much appreciated!
Thank you.


Kind regards,


Jeongsu

Hi Jeongsu, 


The only other way to do this with our existing API endpoints, would be to use the events API. You would basically need to go through the entire folder tree once to get a base line - then monitor the event stream for any future modified, created, of deleted events. 


Thanks, 


Alex, Box Developer Advocate


Hi Alex,


Thank you so much for the tip!
Indeed, the event API could be a good solution.


Best regards,


Jeongsu


Reply