JIRA REST API: how to request a fixVersions field

I need to use the JIRA REST API to return issues with 15824 as the id value in the fixVersions field. As you know, this field is an array and may contain more than one version. My results are expected to have at least one element, sometimes two. Here is a single version example:

"fixVersions": [ { "self": "https:\/\/aDomain\/rest\/api\/2\/version\/15824", "id": "15824", "name": "2014-08", "archived": false, "released": false } ] 

Here is an example with two versions:

 "fixVersions": [ { "self": "https:\/\/domain\/rest\/api\/2\/version\/16011", "id": "16011", "description": "ae426557c89782c8446b03b0eacaef649373b10a", "name": "2.2.0", "archived": false, "released": true, "releaseDate": "2014-08-31" }, { "self": "https:\/\/domain\/rest\/api\/2\/version\/15824", "id": "15824", "name": "2014-08", "archived": false, "released": false } 

]

Regardless of the number of patched versions of the issues that I want, there will always be 15824 .

I tried this query:

 /rest/api/2/search?jql=project=MYPROJECT&fixVersion=15824&fields=id,key,fixVersions 

But this brings back problems with other fixVersions, and sometimes problems without assigned fix versions.

Can you help me?

+5
source share
1 answer

If you specify the JQL part of your query, do not use the & sign, but use the JQL ( AND ) syntax to indicate several conditions.

Sign

& only shares the query string parameters of the query. These are the possible parts of the query string:

  • jql
  • startAt
  • maxResults
  • validateQuery
  • fields
  • expand

So your correct request should be

 /rest/api/2/search?jql=project=MYPROJECT and fixVersion=15824&fields=id,key,fixVersions 
+5
source

Source: https://habr.com/ru/post/1201589/


All Articles