Hello,
I am currently working on a simple Jira Api Class to use for coming API-Calls.
All I currently want is to create a module I can use to authenticate, check authentication and utilize to make GET, SET,.. and other basic API calls.
I wrote the Authentification Header as was suggested in https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/, but get confusing results.
My auth-header looks like this:
self._auth = HTTPBasicAuth(self._email, self._api_token)
which gives me a <requests.auth.HTTPBasicAuth object at ...>.
To test my connection I am running this request:
response = requests.request(
"GET",
url,
headers=self.header,
auth= self.auth, timeout=100
)
given the URL is
url = f"{str(self.base_url)}/rest/api/2/myself".
This function is working and returning a valid request json with my email, accountID and correct baseURL.
So far so good.
To make handling GET request simpler in the future I then proceed to write a funtion that would just make a GET request with given params and my authentification header using:
url = f"{self.base_url}/rest/api/latest/{operation}"
try:
response = requests.request("GET",url,headers=self.header, params=params, timeout=200)
response.raise_for_status()
except requests.exceptions.Timeout as e:
raise TimeoutError('Timeout Error while using GET Method') from e
Now for my problem:
using url =f"{self.base_url}/rest/api/latest/{operation} with operation = "issue/ISSUE-KEY" I get only a 404 Error.
When checking the URl in a browser I am getting the Issue.json as expected.
Thats why I am thinking it might be an authentication problem.
The User used is site-admin.
Any help or redirect would be appreciated,
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.