You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I am trying to conncet jira cloud by using email & api-token and i am getting below permission issue. But I have required access.
jira.exceptions.JIRAError: JiraError HTTP 401 url: https://xxxxxxx.atlassian.net/rest/api/2/issue
text: You do not have permission to create issues in this project.
Welcome to the Atlassian Community.
Are you using this Code.
# This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = "https://your-domain.atlassian.net/rest/api/3/issue" auth = HTTPBasicAuth("email@example.com", "<api_token>") headers = { "Accept": "application/json", "Content-Type": "application/json" } payload = json.dumps( { "update": {}, "fields": { "summary": "Main order flow broken", "parent": { "key": "PROJ-123" }, "issuetype": { "id": "10000" }, "components": [ { "id": "10000" } ], "customfield_20000": "06/Jul/19 3:25 PM", "customfield_40000": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "Occurs on all orders", "type": "text" } ] } ] }, "customfield_70000": [ "jira-administrators", "jira-software-users" ], "project": { "id": "10000" }, "description": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "Order entry fails when selecting supplier.", "type": "text" } ] } ] }, "reporter": { "id": "5b10a2844c20165700ede21g" }, "fixVersions": [ { "id": "10001" } ], "customfield_10000": "09/Jun/19", "priority": { "id": "20000" }, "labels": [ "bugfix", "blitz_test" ], "timetracking": { "remainingEstimate": "5", "originalEstimate": "10" }, "customfield_30000": [ "10000", "10002" ], "customfield_80000": { "value": "red" }, "security": { "id": "10000" }, "environment": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "UAT", "type": "text" } ] } ] }, "versions": [ { "id": "10000" } ], "duedate": "2019-05-11", "customfield_60000": "jira-software-users", "customfield_50000": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "text": "Could impact day-to-day work.", "type": "text" } ] } ] }, "assignee": { "id": "5b109f2e9729b51b54dc274d" } } } ) response = requests.request( "POST", url, data=payload, headers=headers, auth=auth ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
This is tried and tested code.
Make sure you are sending api token of user who has the permission to create issue correctly here
auth = HTTPBasicAuth("email@example.com", "<api_token>")
pls note api token is not password
Thanks,
Sachin
Hi Sachin
I have a similar problem. I am not using the exact code above, but the code used to work on the sever version. I can create tasks in all the projects that from within jira, but it fails using my code.
I would like to give your code a try and this leads to my question.
You write that the API token is not the password. What is it then?
BR Jakob Vang
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.