Unable to add story points with Python API

Hello Folks,

I am using a Python API to do some automation in JIRA Cloud Instance. Now, where I am stuck is I am unable to add story points to a particular story. Below is my code snippet:

from jira import JIRA
user = '************'
apikey = '*******************'
server = 'https://*****.***.com/jira/'

# Creating connection with the JIRA
jira_server = {'server': server, 'verify': False}
jira = JIRA(options=jira_server, basic_auth=(user, apikey))

issue_dict = {
'project': {'key': 'CC'},
'issuetype': {'name': 'Story'},
'summary': "This is a test user story",
'customfield_10204': <sprint_id>
}
jira.create_issue(fields=issue_dict)

The issue created is CC-12093 with id 705378

Now, I need to assign story point to this particular user-story

issue = jira.issue("CC-12093")
issue.update(fields={"custom_field_10208":8})

But I am getting the below error:

response text = {"errorMessages":[],"errors":{"custom_field_10208":"Field 'custom_field_10208' cannot be set. It is not on the appropriate screen, or unknown."}}

P.S.: The story point field is in edit action for an issue and it is of type number.

@BittuBhowmickUS welcome to the Atlassian developer community.

The estimates field is a bit tricky. It might be possible to figure out how to set it directly using the Jira platform API, but I highly recommend the Jira Software-specific API for estimating issue for board using PUT /rest/agile/1.0/issue/{issueIdOrKey}/estimation.

Try customfield_10208 instead of custom_field_10208

Alex

1 Like

Great catch @sash011! Actually, one reason for my recommendation is not needing to do that kind of dereferencing. But I didn’t notice the extra underscore.

1 Like

@sash011 That was a really awesome catch. I am so relieved now as I was struggling with this little extra underscore since many days. Now, the pending piece is I am unable to get the id for estimated time for sub-task as while creating the sub-task if I do an inspect element then I get the id as tt_single_text_orig But unfortunately I am unable to set either it while creating the sub-task.

1 Like

@ibuchanan Thank you so much for your reply. I have my whole piece of code written through the JIRA client API and so I am a bit reluctant to switch to REST API. I would be really grateful if you can provide some links to documentation for the JIRA client Python API

@BittuBhowmickUS,

That’s fair. I thought you might be able to translate my REST API directions into the Jira Python client. It is entirely possible that the “specialized” APIs are not supported by that client. It’s not officially maintained by Atlassian and I am not too familiar with it. From a quick glance at the source code (if that’s the right library), it’s not even full support for the Jira platform APIs, just the stuff that is most common.

In any case, it seems you have a path forward by setting the customfield.

@ibuchanan and @sash011 Thanks to both of you, I was able to get my code work. The other issue which I was talking about has to be resolved as below(for people if they come up with similar issue):

“timetracking”: {
“originalEstimate”: <time such as 1d,1w etc.>
}

1 Like