Skip to main content
Question

EventLog.getEnterpriseEvents returns error

  • May 21, 2025
  • 2 replies
  • 22 views

Forum|alt.badge.img

Hello

 

Calling EventLog.getEnterpriseEvents

with timeframe of (now - 2hrs) until (now) returns error 400 (bad_request):

created_before is beyond one year in the past, API only supports time range starting from one year in the past from now

I'm using the Java SDK and am autenticated properly, with all the possible permissions granted.

 

Please help

2 replies

Forum|alt.badge.img

This seems to work...

 

long current = System.currentTimeMillis();
        Date now = new Date(current);

        long before = current - 7200000;  //2 hours before
        Date twoHoursAgo = new Date(before);

        EventLog events = EventLog.getEnterpriseEvents(api, twoHoursAgo, now);
        for (BoxEvent event : events) {
            System.out.println(event.getType());
        }

Forum|alt.badge.img

See my reply in this answer: http://stackoverflow.com/questions/41413991/box-java-sdk-eventlog-getenterpriseevents-returns-error

 

In short - there is a bug in the REST API where specifying times with +UTC times return an error.