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.
Community moderators have prevented the ability to post new answers.
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.
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
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.