Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to create a ticket using the API but getting errors

Patrick McManus
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2025

Hi all, I am currently trying to connect to Jira Server using the API and Python and I keep getting a couple of errors:

'HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000014F6BEF1690>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))'

when I try to login with my token and 

'HTTPSConnectionPool(host='jira.us.bank-dns.com', port=443): Max retries exceeded with url: /rest/api/2/serverInfo (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)'

when I try with username and password.

I am using the following code to try and make the connection:

 

 

from jira import JIRA
jira_options = {'server': 'https://jira.<domain>'}
jira_user = '<username>'
jira_password = '<password>'

# Establish a connection to Jira
jira = JIRA(options=jira_options, basic_auth=(jira_user, jira_password))

# Define the new issue/ticket
issue_dict = {
    'project': {'key': '<project_key>'},  # Replace with your project key
    'summary': 'API Test',
    'description': 'Detailed description of the issue',
    'issuetype': {'name': 'Bug'}  # Replace with the desired issue type
}

# Create the issue in Jira
new_issue = jira.create_issue(fields=issue_dict)

# Print the created issue's key
print(f"Created issue: {new_issue.key}")

1 answer

0 votes
Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 16, 2025

@Patrick McManus 

Could you try with below code and let me know if it works for you?

I have added 2 lines highlighted in bold and modified jira_options to include verify=False dict value.

 

from jira import JIRA
import urllib3

urlib3.disable_warnings()


jira_options
 = {'server''https://jira.<domain>', 'verify': False}

jira_user = '<username>'

jira_password = '<password>'

 

# Establish a connection to Jira

jira = JIRA(options=jira_optionsbasic_auth=(jira_userjira_password))

 

# Define the new issue/ticket

issue_dict = {

    'project': {'key''<project_key>'},  # Replace with your project key

    'summary''API Test',

    'description''Detailed description of the issue',

    'issuetype': {'name''Bug'}  # Replace with the desired issue type

}

 

# Create the issue in Jira

new_issue = jira.create_issue(fields=issue_dict)

 

# Print the created issue's key

print(f"Created issue: {new_issue.key}")

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events