0

I am using below code to create ticket in jira. I am able to create only TASK. When i create Bug or Story I am getting below error .

issue_dict = {
    'project': {'key': 'TEST'},
    'summary': 'New issue from jira-python',
    'description': 'Look into this one',
    'issuetype': {'name': 'Bug'}
}

new_issue = jira.create_issue(issue_dict)

print(new_issue)

errors :

jira.exceptions.JIRAError: JiraError HTTP 400 url: https://soubhagyapradhan.atlassian.net/rest/api/2/issue
    
    response headers = {'Date': 'Sun, 20 Nov 2022 04:23:17 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'AtlassianEdge',
    'Timing-Allow-Origin': '*', 'X-Arequestid': '023a3f63bfd3ed36e1b1f23637fa115d', 'X-Aaccountid': '5c2cfc199760f569b62799f9', 'Cache-Control':
    'no-cache, no-store, no-transform', 'Expect-Ct': 'report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", 
    max-age=86400', 'Strict-Transport-Security': 'max-age=63072000; preload', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; 
    mode=block', 'Atl-Traceid': '8fa4c1f91d6f9fe1', 'Report-To': '{"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group":
    "endpoint-1", "include_subdomains": true, "max_age": 600}', 'Nel': '{"failure_fraction": 0.001, "include_subdomains": 
    true, "max_age": 600, "report_to": "endpoint-1"}', 'Transfer-Encoding': 'chunked'}
    response text = {"errorMessages":[],"errors":{"issuetype":"Specify an issue type"}}

Please take a look how can i solve this error

1 Answer 1

1

If you look at the error, you can see it says:

"errors":{"issuetype":"Specify an issue type"}

So clearly something must be wrong with how you've set issuetype.


Have you tried looking at the API docs? It seems you could try:

  • Specifying the Issue Type via the issuetypeNames parameter rather than just issuetype; or
  • That you should specify an Issue Type ID rather than an issue type name.

Note that in Jira the Issue Types can be customised, so the issue type that you're trying to create might not always exist / have the same name. You can try getting all issue types for the user to see if that's the case.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.