Hi,
I have been looking into the Java API and I have been reading the auditSearchService and I have been struggling how to use it, to return when a specific user has been added to a specific group.
Can anyone help with an example in groovy code.
Hi,
I have been looking into the Java API and I have been reading the auditSearchService and I have been struggling how to use it, to return when a specific user has been added to a specific group.
Can anyone help with an example in groovy code.
Hi,
You can do like this :
// Create query
AuditQuery auditQuery = AuditQuery.builder()
.maxId(maxId) /* similar to the value from legacy API example */
.minId(sinceId) /* similar to the value from legacy API example */
.searchText(filter) /* similar to the value from legacy API example */
.usersIds(userIds) /* similar to the values from legacy API example */
.from(fromTimestamp) /* similar to the value from legacy API example */
.to(toTimestamp) /* similar to the value from legacy API example */
.build();
PageRequest<AuditEntityCursor> auditEntityCursorPageRequest = new PageRequest.Builder<>()
.offset(offset) /* similar to the value from legacy API example */
.limit(limit) /* number of results, up to PageRequest.Builder.MAX_PAGE_LIMIT */
.build();
// Query
Page<AuditEntity, AuditEntityCursor> auditEntityCursorPage = auditSearchService.findBy(
auditQuery,
auditEntityCursorPageRequest);
// Get actual results from the response
List<AuditEntity> results = auditEntityCursorPage.getValues();
Documentation : Migrating to the new Jira audit log Java API
Hi @FabienPenchenat thanks for the help as per.
Is there a way to specifically search for a group and the user added to that group, as the user in this case is not the author.
In the UI of the audit log these items only appear as “Affected Objects” are these only possible to be found by the searchText in the audit query builder. Ideally I only want to return the results that I specifically care about for performance reasons
In an ideal world, I would have a helper function where I supply a group name and a user and it returns the date when this user was added in to this group according to the audit log?
I have done most things in scriptrunner but this is proving to be a challenge to get it the way I want.
Thanks in Advance.
EDIT: I have managed to get the code to work thanks again