Update Field using Python

Ishrat Lallmamode December 20, 2017

Good morning, 

 

I am trying to update a custom field in Jira, using the following code and I'm getting a 415 error code. Any help would be greatly appreciated! 

 

import json
import requests

jiraSession = requests.Session()


username = input("username: ")
password = input("password: ")
jiraURL = 'http://ourbaseurl.jira.com'


#-------------- CALL -----------------

searchAPI = jiraURL + '/rest/api/2/issue/ISSUE-1'
holder = requests.put(searchAPI, auth=(username, password), data=
{"update":
{"customfield_1000":
{
"set":
{
"value": "FIELD VALUE"
}
}
}})


 

1 answer

1 vote
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2017

Hi Ishrat,

https://jira.readthedocs.io/en/master/examples.html#issues

You can do 

issue = jira.issue('ISSUE-1')

issue.update(fields={'summary': 'new summary', 'description': 'A new summary was added'})
Ishrat Lallmamode December 20, 2017

Thanks!   I was trying to avoid using the jira python library because it runs kind of slow. Though, my custom field is a Tempo field, so I'm assuming that's what's causing my issues. 

edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 20, 2017

This is what i mostly use, haven't had any issues or tested with a Tempo field. I'll take a look.

Ishrat Lallmamode December 20, 2017

I still appreciate your help! I will go ahead and use the jira-python library. 

Suggest an answer

Log in or Sign up to answer