How do I limit response content from getIssuesFromFilterWithLimit()

Geoff Greene October 24, 2012

I have a favorite filter which expressly excludes a lot of extraneous information not needed for the result set, but when I pull issues with the getIssuesFromFilterWithLimit() call, the responses appear to contain the *entire* issue, whereas what I'm looking for is just the fields selected in the filter. I know the result set is large and I'm trying to tune the filter to present just what I need.

Is there a more suitable API? I don't see anything obvious in the JIRA SOAP Service documentation.

Thanks!

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2012

Im not sure you can in SOAP, the limiting in the API call:

http://docs.atlassian.com/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html#getIssuesFromFilterWithLimit%28java.lang.String,%20java.lang.String,%20int,%20int%29

Will only limit relates to the number of issues that are pulled, as its a filter, the number could be large.

You can use REST eg the /rest/api/2/search call, with JQL direct.

Geoff Greene October 24, 2012

Thanks for the response Andy.

I'll try and explain myself a little better. I have a filter that I expect to...

  1. respond with a lot of issues
  2. only respond with the issue data/fields I ask for "in the filter" (* - more on that below) (a couple of key fields like when the issue was created)

The hope was that knowing that I would be retrieving a large volume of issues, I could limit the retrieved issue fields to just what I need since 99% of what's stored in our issues I don't need for this specific purpose.

I used getIssuesFromFilterWithLimit() to retrieve a single issue (maxNumResults == 1) as a test, but the issue I got back had *everything* in it - not just the issue fields specified by the filter.

* - I'm hoping I don't have to filter out the unneeded fields on the client side. I had somehow setup the issue navigator to only display the columns/fields I wanted and I think I led myself to believe that was encoded in the filter, but perhaps its not.

Looks like there is expected to be better ongoing support in the REST APIs. I'll have a look to see if I can find what I'm after there.

If you happen to know of a REST API that could accomplish the above, by all means let me know. The right answer might be to switch from SOAP to REST as you suggest. That's totally OK for me as I've only just started experimenting and don't have anything to "port" yet.

Thanks again.

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2012

I looked but only saw queries for which you need to pass JQL, not a filter reference, perhaps I missed something.

Geoff Greene October 24, 2012

Hey!

This looks very promising!

Query of issues whilst restricting the result's fields

I can just pull the JQL out of the filter and use it directly. I was just using a filter as kind of an indirect way to store a JQL query. I don't *require* being able to access this via a filter necessarily.

However! It looks like with http://example.com:8080/jira/rest/api/2/filter/favourite I can pull the JQL right out of the filter (expand the 200 response) and then supply it to http://example.com:8080/jira/rest/api/2/search supplying the JQL and the specific fields so I don't crush the server.

Hoping to try it out later today maybe (busy day ahead).

Geoff Greene November 1, 2012

Just an update...

Tinkered with jira-python and if it is able to support what I want to do, I don't see it yet.

I'm trying to access the REST API directly with urllib2, but I'm sure I'm doing something silly.

So, in short, no real update yet.

Geoff Greene November 6, 2012

OK. Finally put aside an hour to revisit.

Significant headway with the jira-python module.

No doubt in my mind this is *the* way to do it.

I'm still sort of manually prototyping it here, but when I do a 1-sized REST 'search' using the search_issues method with maxResults=1, I get a single result with all the fields. When I additionally pass a field set string with fields='<my fields>', I get precisely those fields back. I can actually index it by incrementing startAt (not that I intend to).

I'm hardcoding JQL right now, but it also looks like I will be able to pull it out of a call to the 'filter/favourite' response with the favourite_filters method.

So I guess the real answer is stop using SOAP and take a REST. Groan.

TAGS
AUG Leaders

Atlassian Community Events