0
votes

I am trying to integrate Jira with Python using Rest API.

I am using the below mentioned code to create an issue in JIRA using Python. However I am encountering an error mentioned below.

from jira import JIRA

jira = JIRA(basic_auth=('Username,'API Token'), options={"server": "https://ProjectName.atlassian.net/"})

options={"server": "https://ProjectName.atlassian.net/"}

jira=JIRA(options)

test_case_data= {
    "project": {"id": "10000"},
    "summary": "test summary",
    "description": "test description",
    "issuetype": {'name': 'Task'},
}

jira.create_issue(fields=test_case_data)

Below is the error I am getting:

JIRAError: JiraError HTTP 400 url: https://ProjectName.atlassian.net/rest/api/2/issue text: Field 'summary' cannot be set. It is not on the appropriate screen, or unknown., Field 'description' cannot be set. It is not on the appropriate screen, or unknown.enter image description here

3
There's an extra comma after the last key, but this doesn't seem to be the real problem (rather a copy&paste&delete artefact).CraZ

3 Answers

0
votes

Was facing a similar issue today. Try using the full email address associated with the account as the username.

0
votes

Are you able to create a Jira issue with the same account and with the exactly same input data? Is summary field really available?

Checkout Atlassian REST API documentation - they described various cases when server might return error 400. They also use REST API v3, you use v2 (but this shouldn't be a problem).

0
votes

In my Case it helps to make a request only with the type. I see that there are new Types created for the Project. You can found them by get api/projectTypes. Try to let your other fields empty and then you got the message type is invalid. Found the issuetypes for project and use that as id.