box / box-windows-sdk-v2

Windows SDK for v2 of the Box API. The SDK is built upon .NET Framework 4.5

Home Page:https://developer.box.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add File Path or URI-based navigation inputs.

willnationsdev opened this issue · comments

Problem & Alternatives

When I first started using this API, I had a deeply nested folder structure in mind for my app's file data, to keep it organized.

However, even if you already know in advance the exact file path through the virtual Box filesystem that you want to store the file, so long as you don't already have the necessary folder IDs cached, you have to use one of several distinct, but equally roundabout ways to actually get the file/folder you want:

  • Perform a loose search throughout an entire subtree using the Search API and then filter the results to find the folder with the PathCollection details you are looking for.
  • Manually implement your own file navigation API by repeatedly getting folders, iterating over their entries (autopaginated), finding the subfolder that has a matching name for the current segment, and gradually building up to the actual file or folder you seek (horrible performance).
  • Dump everything at the root directory with completely unique names, but set up and maintain metadata templates for everything (complete with query indexes you must request from Box official team members) in order to properly query data when you go over 10,000 items (quite an excessively complicated solution with unnecessary administrative red tape & configuration).

Considering that I already know the exact path to navigate already, Box does not offer any simple solution to just get me the thing I want directly & without needing to provide additional filtering once I have the results. The first option is the closest one available, but even that still requires extra work on the application side to get the targeted leaf item reliably.

Proposed Solution

The first option is the simplest fallback available, but it would be a lot more convenient if the Box API itself offered a built-in solution for allowing people to just navigate directly to whatever file or folder they are looking for using a string path or a Uri (with whatever arbitrary protocol/domain Box sees fit to expose, if they go that route, e.g. box://[user|enterprise]/path/from/root/to/file).

example:

// Get Root Folder (with string path)
var folder = await Client.FoldersManager.GetInformationByPathAsync("/");

// Get Root Folder (with Uri uri)
var folder = await Client.FoldersManager.GetInformationAsync(new Uri("box://user/"));

// Get /docs/README.md file (with string path)
var file = await Client.FilesManager.GetInformationByPathAsync("/docs/README.md");

// Get /docs/README.md file (with Uri uri)
var file = await Client.FilesManager.GetInformationAsync(new Uri("box://user/docs/README.md"));

Similar variants for uploading, downloading, creating, updating, and deleting files & folders would likewise be very helpful.

Hi Will,

Thank you for your valuable suggestion! We appreciate your input and are always eager to enhance our API to better serve your needs.

Your suggestion has been noted, and we encourage you to submit it through our feature request platform at pulse.box.com. Our product team regularly reviews requests there and evaluates them for potential enhancements.

Please feel free to share any additional details or specific use cases for this feature to help us understand your needs better.