Search code examples
jirajira-pluginjira-rest-java-api

Search Version jira rest api


I need to get all issues by version id. My query is like:

http://archwork:2990/jira/rest/api/2/search\?jql\=project\=GP+and+fixVersion\=10001

working fine, but I want to get issues by VERSION

Link like:

http://archwork:2990/jira/rest/api/2/search\?jql\=project\=GP+and+version\=10001

returned "Field 'version' does not exist or you do not have permission to view it."


Solution

  • The two built-in version fields in JIRA can be accessed in JQL as fixVersion and affectedVersion. I suspect that you want the latter.

    If you have another custom field (which is a version-type field) that you want to query, the error message suggests that you may not be using the correct name for it. The best way to check this is to type your JQL into JIRA's Issue Navigator manually (in the advanced search) and to take advantage of the dropdown box with field name suggestions to get the correct field name.

    One way to bypass the problem of determining the correct JQL field name (which sometimes requires quoting, which gets slightly more messy if you are also URL-encoding the result) is to simply refer to a field by the custom field ID instead.

    You can find the CF ID of a field by going to Admin->Issues->Custom Fields, finding the appropriate custom field, mousing over the "Configure" link, and then looking at the URL query parameter for customFieldId, and then use the syntax cf[xxxxxx] in your JQL instead of the field name, where xxxxxx is the custom field number.