Here's the sample code that I am trying to pull enterprise events using Box API-
TimeZone tz = TimeZone.getTimeZone("UTC");
Calendar start = Calendar.getInstance(tz);
start.add(Calendar.MONTH, -1); // retrieve events for last one month
Calendar end = Calendar.getInstance(tz);
try {
EventLog el = EventLog.getEnterpriseEvents(api, start.getTime(), end.getTime(), BoxEvent.Type.values());
System.out.println("Total- " + el.getSize());
for (Iterator<BoxEvent> iterator = el.iterator(); iterator.hasNext();) {
System.out.println(iterator.next().toString());
}
} catch (BoxAPIException ex) {
ex.printStackTrace();
System.out.println(ex.getResponse());
}
And the actual error that I am getting-
{"type":"error","status":400,"code":"bad_request","help_url":"http://developers.box.com/docs/#errors","message":"created_after is beyond one year in the past, API only supports time range starting from one year in the past from now","request_id":"310879445579d0cc0fd33"}
The error is that "start" seems to be too old (at least 1 year old) and causes a 400 error, because the API don't support it.