0

Have a group of users who would like to receive access reports (download, view, etc.) for content they own under a set of folders. This set of folders isn't super dynamic, so in theory we could maintain a static list, but would love to make this fully automated.

My initial thought was to have the users add a special tag to a folder they want to include in the report. Then I could search all enterprise events for items affecting items which live under a tagged folder and spit it out into a CSV file.

Maybe I can search for all tagged folders, gather the folder id's then loop through my enterprise events looking for any item with an ancestor folder that matches?

rayvd
  • 15
  • 3

1 Answers1

0

Your approach makes sense. You can get this data using the Events API as you described. Another approach would be using webhooks.

Approach One: Events API

  1. Add a tag to the folder you want to monitor.

  2. Use the Search API to return folders that match this tag.

    /search?query=TAG_EXAMPLE&type=folder&content_types=tags

  3. Use the Events API to get all events.

    /events?stream_position=0

  4. Parse for Downloaded and Previewed events, where the event is for file that has a matching parent folder from the folder list in Step 2.

Approach Two: Webhooks

  1. Add a tag to the folder you want to monitor.

  2. Use the Search API to return folders that match that tag.

    /search?query=TAG_EXAMPLE&type=folder&content_types=tags

  3. Create a webhook in Box that notifies an external application when a file is downloaded or previewed. Add a parameter to webhook for the file's parent folder.

  4. Create an application that listens for these webhooks.

  5. Parse for events, where the event is for a file that has a matching parent folder from the folder list in Step 2.

Community
  • 1
  • 1
Murtza Manzur
  • 1,224
  • 1
  • 8
  • 12