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
Published in Apps & Integrations

Partner Webinar Opportunities: January 2022

Hi everyone 👋, I really like the format of the webinar opportunities summary that @Jimmy Seddon posts monthly on the Welcome Centre group. It's a great place to go to check that you didn...

29 views 0 1
Read article

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