Newbie question: I've been successfully using the Jira REST API to create some issues. I am now trying to create Epic links and I am confused as to how this is supposed to work. I found a custom attribute that that appears to be relevant. I tried setting this attribute to the issue ID of the Epic using a structure like
{
"fields": { "customfield_13401": "MYPROJ-100" }
}
and I got
gh.epic.error.not.found
My questions are, then:
Any help is appreciated.
That looks like the correct format.
Are you 100% sure your Epic Link field has that customfield ID number and you have an Epic with that Key?
I actually managed to get it working. I had the Epic ID name wrong.
My only question at this point is whether there is a reliable way to retrieve the field ID through the script rather than hard-coding it. My concern is that if our administrators were to change the ID at some point in the future the flow would break and it might not be obvious to anybody why.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear it was just a typo.
An admin changing a custom field is a possibility, but it's rare. It's more common that two custom fields with the same name but with different IDs have been created.
You can deal with the first possibility by:
1. Getting all the fields by calling the rest/api/2/field endpoint. then iterating through the results to find the one you want. This can't overcome two fields with the same name. If you encounter this, just bring it to the attention of the admins to change one of the field's name.
2. Store the names and IDs of the custom fields in a local configuration file that the script parses at run time. You could store that config file in a distributed location to centralise that data.
In Jira Cloud, v3 of the REST API has a new endpoint that returns the list of fields in a paginated format, so that you can filter the request to only return fields that match a pattern, start at a certain number, have the results returned in a particular order etc. This makes looking up fields much easier and hopefully this will come to Jira Server soon.
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.