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)
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.
However, while checking the create issue screen by clicking on create I see all these fields visible. Please help in resolving this. I have read on other posts that this could be some authentication issue and the error might be misleading, But not aware to resolve this.
Hi @Amit Raghuwanshi ,
welcome to the Atlassian Community!
I believe the problem is your test_case_data is not in the correct format, it should look like this, see here:
{
"fields": {
"summary": "test summary",
"issuetype": {
"id": "10000"
},
"project": {
"id": "10000"
},
"description": "test description"
}
}
Thanks for your reply, I have found the resolution:
1. Error message was misleading
2. issue actually lied with the authentication credentials, once I fixed those, it started working smoothly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.