-
Notifications
You must be signed in to change notification settings - Fork 479
Closed
Description
Hello. I am able to pull group audit events using a cURL command directly from the command line, but I am not able to use the gitLabAPIs. Following is the code that is not working as expected. I tried using pager.all and the for loop. The issue is that the pager object is always empty. Since the group id is correct, I am guessing it must be something with the date formatting. Please let me know how to correct this issue.
String startString = "2025-06-15 00:00:00";
String endString = "2025-07-02 23:25:59";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime startLocalDate = LocalDateTime.parse(startString, formatter);
LocalDateTime endLocalDate = LocalDateTime.parse(endString, formatter);
Instant startInstant = startLocalDate.atZone(ZoneId.systemDefault()).toInstant();
Instant endInstant = endLocalDate.atZone(ZoneId.systemDefault()).toInstant();
Date startDate = Date.from(startInstant);
Date endDate = Date.from(endInstant);
// Substituted the real group number with this bogus one for the example...
List<AuditEvent> events = gitLabApi.getGroupApi().getAuditEvents(12345678, startDate, endDate);
//List <AuditEvent> events = pager.all();
logger.info("Total Audit Events: " + events.size());
for (AuditEvent event : events) {
System.out.println(event.getAuthorId() + " -: " + event.getEntityType());
}
Metadata
Metadata
Assignees
Labels
No labels