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

POST request to JIRA REST API to create issue of type Minutes

my $url2 = 'https://url.com:123/rest/api/2/issue';
my $create_issue_json = '{"fields": { "project": { "key": "NCG3D" }, "summary": "summary of my first issue", "versions": [{"Affects Versions/s": "v2.1"}, {"name": "v2.1"}], "Brands": ["Opel"], "components": "SW_VERSION", "description": "Creating an issue via REST API", "issuetype": { "name": "Minutes" }}}';

$tx1 = $jira_ua->post($url2 => json => decode_json($create_issue_json));
my $res1 = $tx1->res->body;

The above produces the following output

{"errorMessages":["Brands: Brands is required.","Detection: Detection is required."],"errors":{"components":"Component/s is required."}}

But these fields are available only in issue of type bug and not for type Minutes.

2 answers

1 accepted

0 votes
Answer accepted

Sorry, this is due to the configuration issue at Jira Admin side which I wasn't aware of before and now I've requested to correct(to remove mandatory option for Brands and Detection) and it works okay now.

0 votes
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 08, 2022

Hi @Arjun 

Welcome to the Community!!

I'm mesmerized by the API Call

Can you try the below API and let me know if it works

pip install atlassian-python-api


jira = Jira( url='https://your-jira-instance.company.com', token=jira_access_token )

fields
= {'summary': 'New summary'} jira.issue_create(fields)

https://atlassian-python-api.readthedocs.io/jira.html

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post

Thanks

@Pramodh M

from atlassian import Jira

jira = Jira( url='https://jira.instance.com', token='used PAT token' )

fields = {'project': 'sample', 'summary': 'sample issue'}
jira.issue_create(fields)

produces below o/p:

(base) D:\scripts>python issue.py
Creating issue "sample issue"
Traceback (most recent call last):
File "issue.py", line 6, in <module>
jira.issue_create(fields)
File "C:\Users\aeu5cob\AppData\Roaming\Python\Python38\site-packages\atlassian\jira.py", line 1166, in issue_create
return self.post(url, data={"fields": fields})
File "C:\Users\aeu5cob\AppData\Roaming\Python\Python38\site-packages\atlassian\rest_client.py", line 309, in post
response = self.request(
File "C:\Users\aeu5cob\AppData\Roaming\Python\Python38\site-packages\atlassian\rest_client.py", line 242, in request
self.raise_for_status(response)
File "C:\Users\aeu5cob\AppData\Roaming\Python\Python38\site-packages\atlassian\rest_client.py", line 399, in raise_for_status
raise HTTPError(error_msg, response=response)
requests.exceptions.HTTPError: project: project is require

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events