Create issue via python rest api jira
Asked Answered
S

2

7

So, I have written python code which interact with Jira api via python library atlassian_python_api

from atlassian import Jira

jira = Jira(
     url="https://jira.example.com/",
     username='gonchik.tsymzhitov',
     password='admin')

jira.issue_create(fields={
    'project': {'key': 'TEST'},
    'issuetype': {
        "name": "Task"
    },
     'summary': 'test rest',
     'description': 'rest rest',
})

After the issue has been created with key TEST-2045 (the number 2045 was generated automaticly).

The question is: How can I insert my own issue number? For example, TEST-15 ?

Simla answered 15/8, 2019 at 8:36 Comment(1)
You cannot control that.Estrin
I
3

that's the 'key' field. and you can't provide it while creating jira issue, it's predefined behavior see the topic at atlassian forum: https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-specify-key-when-creating-issue-via-API/qaq-p/574472

Immunize answered 15/8, 2019 at 8:49 Comment(0)
F
0

For those of you who might run into the error JIRA' object has no attribute 'issue_create':

it should be "jira.create_issue".

Featherbedding answered 12/4, 2022 at 8:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.