Reputation: 806
from jira import JIRA
jira = JIRA(basic_auth=("[email protected]", "9uQ7ll78jq7AmY3Xh5ghF9A9"), options={"server": "https://soubhagyapradhan.atlassian.net"})
Jira integration code
data = {
"project":
{
"key": "TEST"
},
"summary": "REST ye merry gentlemen.",
"description": "Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {
"name": "Bug"
}
}
res = jira.create_issue(fields=data)
print(res)
Error i am getting
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://soubhagyapradhan.atlassian.net/rest/api/2/issue
response headers = {'Date': 'Thu, 10 Nov 2022 18:55:40 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'AtlassianEdge', 'Timing-Allow-Origin': '*', 'X-Arequestid': '99553b2ab107cf312060560b7e28c34f', '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': 'f18031aca50ee85e', '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"}}
I am using above code to create tickets in jira. I am getting above error while creating the ticket. Please take a look how can i solve this issue
Upvotes: 1
Views: 636
Reputation: 31
Try to create your type of issue in your Jira project first.
Project settings -> Details -> Issue types -> Add issue type -> "name": <my_issue_type_name>
Upvotes: 3