Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to populate native versions fields while creating an issue via API

Antoine _Klee Group_
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.
August 10, 2021 edited

Hello,

I want to create an issue in Jira using the Rest API.

Here is the JSON I am sending.

{
    "fields": {
        "project": {
            "key""KEY"
        },
        "summary""Populating affects version",
        "issuetype": {
            "name""Bug"
        },
        "versions":[{ "name": "1.0" }]
}
}

 This works just fine when the name of the version already exists in the project but prompts an error if not.

"errors": {"versions""version name '1.1' is not valid"}

Is there a way to populate the "affects version" (or any versions field) field if the value does not yet exist within the project?

Thanks.

1 answer

1 accepted

0 votes
Answer accepted
Alex Koxaras -Relational-
Community Champion
August 10, 2021

HI @Antoine _Klee Group_ ,

The reason why most likely this is happening, is because you are sending a request to create a new issue, and not a new version (which relates to the project) To create a new version you must follow this API:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-post

You could somehow use the native automation, which has the ability to create a new version.

Alex

Antoine _Klee Group_
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.
August 10, 2021

Thanks that is what I did in the end. I was actually wondering is there was any way to create versions "on the fly". Aka if it does not already exist then it is created.

Infact there does not seems to.

Like • Alex Koxaras -Relational- likes this
Alex Koxaras -Relational-
Community Champion
August 10, 2021

It's good that you did that @Antoine _Klee Group_! Well done!

Kindly mark this answer as accepted, so as to help other people in this community to find the right answer to similar question.

Thanx!

Like • Antoine _Klee Group_ likes this

Suggest an answer

Log in or Sign up to answer