Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Asked in Jira Service Desk

Calling all Insight users, we need your help!

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials. It would really helpful if you can ...

97 views 1 0
View question

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you