I am new to Atlassian product(JIRA).So far I have tried multiple jira "CLOUD" api through python.And it works perfectly. Now I want to try the same API in jira "SERVER".
My doubt is?
1.Can I use the same code(jira cloud api) in server or it is going be completely different.If it is different please guide me regarding that.
2.Only the auth process is different for both cloud & server.
#I am attaching my jira cloud api code(python) using HTTP Auth.
import requests
import json
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth("username", "Api_Token")
def View():
key=input("issuekey/issueid")
url = "https://domain.atlassian.net/rest/api/3/issue/"+key
headers = {
"Accept": "application/json"
}
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
#This is working perfectly in case of viewing the details of an issue(Jira cloud api).
How do I modify the same code to work in jira server api?
Hi @Indumathi S
Welcome to Community!!
Use the Python wrapper API - https://atlassian-python-api.readthedocs.io/
Available with both Server & Cloud
Issues link below
https://atlassian-python-api.readthedocs.io/jira.html#manage-issues
Authentication is as below
https://atlassian-python-api.readthedocs.io/#other-authentication-methods
Let me know if you have any queries
Thanks,
Pramodh
Hi @Pramodh M
I tried to create a issue(JIRA-SERVER) using py client lib.
from jira import JIRA
auth_jira = JIRA(basic_auth=('username', 'password'))
jac = JIRA('https://domain.atlassian.net')
new_issue = jac.create_issue(project='project key', summary='New issue from jira-python',
description='Look into this one', issuetype={'name': 'Bug'})
I am getting error like:
WARNING:root:HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021175DD4220>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) while doing GET http://localhost:2990/jira/rest/api/2/serverInfo
WARNING:root:Got ConnectionError [HTTPConnectionPool(host='localhost', port=2990): Max retries exceeded with url: /jira/rest/api/2/serverInfo (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021175DD4220>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))] errno:None on GET http://localhost:2990/jira/rest/api/2/serverInfo
{'response': None, 'request': <PreparedRequest [GET]>}
{'response': None, 'request': <PreparedRequest [GET]>}
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.