Reputation: 1185
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 (w/ private key, JWT), with all the possible permissions granted.
Please help
Upvotes: 0
Views: 73
Reputation: 1185
There is no issue with the request made via the SDK,
the issue is in the underlying REST API - it has a bug where date formats with +UTC throw an error (where -UTC is just fine).
The SDK uses DateFormat class to stringify the Date object, and I'm located at a zone which is at UTC+200.
This is very strange that this wasn't picked up as this effects half of the planet users who will attempt to use this REST API (and SDK).
As workaround, I forked the SDK and formatting using normalized UTC date, so I don't get +UTC.
i.e.
DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(date.toInstant().atZone(ZoneOffset.UTC));
Also, I submitted a bug to Box engineers.
Upvotes: 1