Receiving error when trying to use jira.create_issue

Mont
Contributor
May 5, 2023

Hello,

I'm trying to make an API call to JIRAs API to create a new issue. I followed the instructions in documentation and created jira_client to call the API to create_issue; however, I am receiving a very vague error just indicating an HTTP Cleint Error.

There's no username used from what I know or required in test environment I'm running on.

Does anyone know what could possibly cause these errors or a way to troubleshoot to determine the cause?

HTTPError: 400 Client Error: for url: https://jira.<domain_name>.com/jiradp/rest/api/2/issue?updateHistory=false

Here's my sample code

# Call JIRA to create ticket
from atlassian import Jira, errors

def get_jira():
    jira_client = Jira(
    url='https://jira.<domainname>.com/jiradp',
    #username=settings.jira_username,
    #password=settings.jira_api_key,
    cloud=False
     )
    return jira_client


jira_client = get_jira()

issue_dict = {
    "project": {
    "id": '2',
    "summary": 'test summary',
    "description": f'New issue for Me',
    "componenets": [{'Remediation': 'Test',
    'AWS Documentation': 'Test Document'}],
    "reporter": {"name": "101"},
    "issuetype": {"name": "11500"},
    "priority": {
        "name": "CRITICAL"
     }
     }}

2 answers

1 accepted

2 votes
Answer accepted
Mont
Contributor
May 5, 2023

Looks like I was missing a curly bracket at end of project id

Lorien Anderson August 15, 2023

Untrue. I pasted issue_dict into python and it's a normal dict.

Lorien Anderson August 15, 2023

There must be some other reason this was failing... 

0 votes
Lorien Anderson August 15, 2023

I'm having the same issue. Any insights would be appreciated!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events