Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

I am not able to create issue through python script

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.

1 answer

1 vote
Sachin Dhamale
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 11, 2022

@ramesh.na1 

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events