SummerCode
SummerCode

Reputation: 1403

get property of version in JIRA REST - how to use search jql?

I am trying to get 2 properties of Jira's versions, namely to check whether it was released or not and get his name. How can i get this information with REST?

Up to now i have managed to get the versions JSON, by using: https://myproject/rest/api/2/project/projectkey/versions/

but when i try to add a search?jql=released=false i get a status 404...

Thanks in advance!

Upvotes: 2

Views: 1206

Answers (2)

luviktor
luviktor

Reputation: 2270

Well, Volodymyr answered your original question properly.

The answer to your second question is that you cannot filter the versions that way. JIRA REST API uses the following URL scheme

http://host:port/context/rest/api-name/api-version/resource-name

and this is transformed to your current URL as

https://myproject/rest/api/2/resource-name

The resource-name part is the key. There are multiple resources which you could use. One of them is the project other is the search. On the same documentation page you can find the details of each resources where you could see that the project resource is basically used to query the projects. There are some other URL's for querying a specific project and some important attibutes (like all of the versions, or just a specific version).

The search resource is used to query JIRA issues. The syntax which you added to your post is resembles of an issue query. These two cannot be mixed. You can read more about the JQL syntax on the Advanced searching page of the JIRA documentation

AFAIK the JIRA REST API doesn't provide a way where you could query "the unreleased versions for a given project". You have to query all the versions and filter out the results programmatically.

Upvotes: 1

Volodymyr Krupach
Volodymyr Krupach

Reputation: 918

I guess that you need to find all released versions by iterating results from /rest/api/2/project/projectkey/versions/ and then you can search for issues that are mapped to these versions:

 fixVersion in ("1.1", "1.2")

Upvotes: 2

Related Questions