Forums

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

Cannot send get request to jira

Kannpitcha Paponphatsiri October 30, 2023

I'm building flask application and trying to send get request to JSM cloud from it; however, I got this error message:  "Client must be authenticated to access this resource.","status-code": 401. Here's my code:

    jiraurl =  request.args.get('jiraurl')
    usrname =  request.args.get('usrname')
    pwd = request.args.get('pwd') #API_token
    url = "https://" + jiraurl +"/rest/servicedeskapi/servicedesk"
    auth = HTTPBasicAuth(usrname, pwd)
    headers = {
    "Accept": "application/json"
    }

    response = requests.request(
        "GET",
        url,
        headers=headers,
        auth=auth
    )

    print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

1 answer

1 accepted

2 votes
Answer accepted
Sebastian Krzewiński
Community Champion
October 30, 2023

Hi @Kannpitcha Paponphatsiri !

 

Please check this answer - https://community.atlassian.com/t5/Jira-questions/ERROR-quot-message-quot-quot-Client-must-be-authenticated-to/qaq-p/1076087

Looks like you need to add header or switch to api tokens.

 

Regards,

Seba

Kannpitcha Paponphatsiri October 30, 2023

Thank you for help!

Suggest an answer

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

Atlassian Community Events