Skip to main content
Question

API File Question

  • May 21, 2025
  • 3 replies
  • 6 views

Forum|alt.badge.img

As an enterprise developer (Box Enterprise user), is there a way through the API's to retrieve detailed information on user downloads of a file.

 

In particular:   

 

1.  Who downloaded the file (username)

2.  When the downloaded it (date and time)

 

Thanks!

 

Patrick

3 replies

Forum|alt.badge.img

So I tried the EventLog API and even though it doesn't filter by EventType, it seems to get the DOWNLOAD info.

 

Date beginDate = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 2));
Date endDate = new Date(System.currentTimeMillis());

EventLog eventLog = EventLog.getEnterpriseEvents(api, beginDate, endDate, BoxEvent.Type.ITEM_DOWNLOAD);

for (BoxEvent event : eventLog) {
            System.out.println("Enterprise Event Created by User: "
                    + event.getCreatedBy().getName()
                    + " File: " + event.getSourceJSON().get("item_name")
                    + " Event Type: " + event.getType()
                    + " Created at: " + event.getCreatedAt().toString());
}

And here's the output:

 

Enterprise Event Created by User: Ken.Domen.Test File: "ken.png" Event Type: UPLOAD Created at: Sat Nov **removed**:29:18 PST 2016
Enterprise Event Created by User: Ken.Domen.Test File: "ken.png" Event Type: DOWNLOAD Created at: Sat Nov **removed**:34:38 PST 2016

 

 


Forum|alt.badge.img

Interesting ... Thanks Kendomen!

 

I am assuming that if there was more than DOWNLOAD event type within the period, this would return them all.?.

 

Very cool!


Forum|alt.badge.img

Yes.  It seems to behave that way.  Thanks!