I am working on a script that uses Jira's REST API to gather all customer information from our project and print it. This is just a small test to pull data from Jira.
The following is what i've cobbled together from resources to do this. Adminemail and API token are filled out properly, along with the website URL. I am utilizing Python to write the script and interact with the REST API.
import requests
import json
import base64
jiraCred = "Basic " + base64.b64encode(b'Adminemail@email.com:APITOKEN').decode("utf-8")
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-ExperimentalApi": "opt-in",
"Authorization": jiraCred
}
url = "https://oursite.atlassian.net/rest/servicedeskapi/servicedesk/6/customer"
response = requests.request(
"GET",
url,
headers=headers
)
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
With all this I still seem to get, " "message": "Client must be authenticated to access this resource." So something must be going wrong with how I'm authenticating the user and API token.
Does anyone have any experience with this and might know what i'm doing wrong?