Hi,
I am trying to build an Alexa skill integrated with Jira.
I need to collect the story point of each issue but the response from rest API does not have any dedicated key in JSON to get the “story points”.
It might vary based on jira the server URL.
Example- in our case, “customfield_10004” is defined for story points.
Is there any solution to this? Do you think there could be any other way to get the story points of each issue and subtask?
Hi Yashica.
The way you can consistently get the story points of an issue is to first determine what custom field story points are on for that instance.
To do this, search through the fields using this endpoint: /rest/api/3/field
This will return an array of objects.
Filter the array, looking for the object with the name 'Story points estimate' if it's a next-gen project or 'Story Points' if it's a classic project.
It will look something like this:
{
"id":"customfield_10016",
"key":"customfield_10016",
"name":"Story point estimate",
"custom":true,
"orderable":true,
"navigable":true,
"searchable":true,
"clauseNames":[
"cf[10016]",
"Story point estimate"
],
"schema":{
"type":"number",
"custom":"com.atlassian.jira.plugin.system.customfieldtypes:float",
"customId":10016
}
},
Save the id of this object (in this case customfield_10016). Then look for that custom field every time you request an issue.
This will get you the story point estimate of your issue every time.
Hope that helps!
Great answer!
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sometimes I wonder if the people designing these Atlassian rest APIs ever actually spoke to developers or considered how they would be consumed... always feels like so much effort for the simplest thing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@D Smith - Atlassian very much do talk to developers, they even pay for flights and hotels in order to get external people to work with them.
I'm not in the right role to get a trip to Sydney from them, but I know a lot of Adaptavists who have worked with Atlassian on how they should be extending the REST APIs (and other stuff). As an example, three of us spent a couple of weeks there working on how to enable Scriptrunner Behaviours on cloud.
So, yes, stop wondering, Atlassian are listening, and working with partners as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only solution is to code defensively - not only do you have to assume the cusomfield_id for Story Points varies by system, it might not be the estimation statistic in that system or project.
The best you can do defensively is to use https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-api-3-issue-issueIdOrKey-editmeta-get to get the fields available for edit in a project, and parse through it looking for something that might be named similarly to "story points".
But, I'd be asking the user to do some setup and tell your application what the field is in their Jira.
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.
Um, look at the issue?
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.