Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,014
Community Members
 
Community Events
168
Community Groups

Rest call not returning updated info

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.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events