The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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!

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events