It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

put some information in fieds

Hello I have  a CSV file , I extract information from the file with a python script : like date , issue name ...  the second part of my script will be  to put those information in the custom fields on jira , automatically , I tried to  check the API python jira but I did'nt understand well how I can do it. 

Thanks for your help

2 answers

1 accepted

0 votes
Answer accepted

If you're assigning the CSV data to variables already, you should be able to assign them to custom fields using a dictionary.  The custom fields in my example are text fields, but this logic should work. You'll want to replace the customfield_ID with the IDs from your environment.

 

from jira import JIRA


jira_options={'server': 'http://example.com'}
jira=JIRA(options=jira_options,basic_auth=('username','password'))

<Your existing code for importing data from CSV>


issue_dict = {
'project': {'id': <project_id>},
'summary': 'New issue from python script',
'description': 'Your description here',
'issuetype': {'name': 'Bug'},
'customfield_10400': variable1
'customfield_10401': variable2
'customfield_10402': variable3
}


new_issue = jira.create_issue(fields=issue_dict)
0 votes
Timothy Chin Community Leader Jan 11, 2018

thank you for your answer , but the link your sent to me doesn't help that much in my case

The REST API is the way to do this, but we can't really help you with the Python.  Have a look in Python resources for "how do I make a REST call to another system from my Python code"

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Apr 09, 2019 in Portfolio for Jira

Portfolio for Jira 3.0 is here!

The wait is over... Portfolio for Jira Server and Data Center 3.0 is now officially here! Platform releases offer Atlassian an opportunity to shift our strategy, make bold predictions about t...

1,549 views 14 26
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you