Hi everyone,
I’m currently trying to write a ScriptRunner script in Groovy to access audit logs in Jira Data Center (version 9.12.15). According to the Atlassian Audit API documentation, I should use the AuditSearchService
with AuditQuery
and PageRequest
.
However, I’m completely stuck because the PageRequest
class simply cannot be resolved. I’ve tried importing it from multiple suggested packages like:
import com.atlassian.audit.api.pagination.PageRequest
import com.atlassian.audit.api.pagination.PageRequests
or even directly from:
import com.atlassian.audit.api.PageRequest
But none of these imports resolve correctly, and my IDE as well as the ScriptRunner script editor continue to indicate that PageRequest
is missing.
Here’s an example of my intended code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.audit.api.AuditSearchService
import com.atlassian.audit.api.AuditQuery
import com.atlassian.audit.api.pagination.PageRequests
AuditSearchService auditSearchService = ComponentAccessor.getOSGiComponentInstanceOfType(AuditSearchService)
AuditQuery auditQuery = AuditQuery.builder().searchText("User deactivated").build()
// This line won't compile because PageRequests/PageRequest cannot be found
PageRequest pageRequest = PageRequests.limit(100)
// Intended usage:
def results = auditSearchService.findBy(auditQuery, pageRequest)
Am I missing something crucial here? Are these classes deprecated, moved, or differently implemented in Jira Data Center 9.12.15? I’m quite frustrated because I followed the documentation closely, and yet nothing seems to match my installation.
Any help or clarification would be greatly appreciated!
Thanks!