Hi.
I've created a REST endpoint using script runner to view all filters owned by a certain JIRA user.
The REST call returns the filter id and the JQL string in a json format.
When the JQL string in a filter is changed in JIRA is does not reflect in the REST call.
def filterManager = ComponentAccessor.getComponent(SearchRequestService)
def queryManager = ComponentAccessor.getComponent(Query)
def userManager = ComponentAccessor.getUserManager()
def user= userManager.getUserByName("JIRA-USER")
def queries = [:]
for (query in filterManager.getOwnedFilters(user)){
queries.put(query.getId(),query.getQuery().toString())
}
@BaseScript CustomEndpointDelegate delegate
Filters(
httpMethod: "GET", groups: ["JIRA-GROUP"]
) { MultivaluedMap queryParams, String body ->
return Response.ok(new JsonBuilder([Filters: queries]).toString()).build()
}
Can you please give me some insight on why this might be happening.
Also, when I run the code in the Console I get the updated JQL string.