Hello!
I'm trying to get used to the rest API, as I want to update the description of a version with it.
I already found how to do it, but you need the version id to do it, and I don't know how to get it with the API. When I write something like this :
curl -i -u username:password -H "Content-Type: application/json" -X GET -d http://jira/rest/api/latest/project/SBX/versions
I get every version of it. How can I do to only get the ID of the version named "V5" ?
Thank you
Community moderators have prevented the ability to post new answers.
as of now there is no REST to get project version by name, check this doc for latest REST api's
https://docs.atlassian.com/jira/REST/latest/
only way is you have to get all project versions and iterate response and need to get ID
@valipost nicola HI can You post the answer? I know it is too long time ago, But if possible please post it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@tony cameraman you can use this:project_versions
(project)[source]
Get a list of version Resources present on a project.
Parameters:Return type:
project (str) – ID or key of the project to get versions from |
List[Version] |
in Python 3:
#prints out 10 latest version name & id
for version in jira.project_versions(project_key)[-10]:
print(version.name,' | id:',version.id)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't use the version field - but if it's like the fixVersion field, the answer is yes.
Run a query to find any single JIRA issue in version V5.
https://jira/rest/api/latest/search?jql=fixVersion=7.3.2.3&maxResults=1&fields=*all
then look at result.issues.fields.fixVersions.id.
Does that help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cool workaround... its weird to this date there is no "get version by name"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.