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: 

Creating a new ticket via API with custom fields

William Davis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2023

Hello,

 

I have been looking to create an API post to Jira via Python which would create a ticket.

 

I have been successful in creating the ticket with a Project, Summary, Description and Issue Type. However, when I go to add a new Custom Field I am struggling. I have included the code below which was successful for the initial ticket creation;

new_issue = jira.create_issue(project='ProjectName', summary='New issue', description='Look into this one', issuetype={'name': 'Initiative'})

 

Then below is the attempt to add in the custom fields which failed.

 

new_issue = jira.create_issue(project='ProjectName', summary='New issue', description='Look into this one', issuetype={'name': 'Initiative'}, fields={'14778': 'Information'})

 

Any help is greatly appreciated!

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jeroen Poismans
Community Champion
December 12, 2023

Hi and welcome to the Community!

How you set customfields with the REST API depends greatly on the type of field. Furthermore you also did not specify whether you are using server, datacenter ord cloud, which can lso be a different approach. That being said I can see something weird in your call:

fields={'14778': 'Information'}

Pretty sure this should be:

fields={'customfield_14778': 'Information'}

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

Server:
https://docs.atlassian.com/software/jira/docs/api/REST/9.11.0/#api/2/issue-createIssue

Regards,

Jeroen