Not able to link an epic to issue via rest api

nik1989 May 29, 2018

I am able to create the issue successfully  but Epic Link which is a custom field is not set

api : https://track-api.com/jira/rest/api/2/issue

issue Post Data

 

{'fields': {'summary': 'summary', 'issuetype': {'self': 'https://track-api.com/jira/rest/api/2/issuetype/12200', 'id': '12200', 'description': '', 'name': 'Service Entitlement', 'subtask': False, 'avatarId': 17100}, 'customfield_17002': {'self': 'https://track-api.com/jira/rest/api/2/customFieldOption/18265', 'value': 'False', 'id': '18265'}, 'description': 'decription', 'project': {'self': 'https://track-api.com/jira/rest/api/2/project/25400', 'id': '25400', 'key': 'TESTPREM3', 'name': 'Test Premium3 Premium Health check', 'customfield_16900': {'self': 'https://track-api.com/jira/rest/api/2/customFieldOption/18260', 'value': 'Premium 3.0', 'id': '18260'}, 'customfield_10903': 'TESTPREM3-126'}}

 

customfield_10903( Epic Link)

 

 

2 answers

3 votes
Alexey Matveev
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.
May 29, 2018

You should use Jira software API for it POST /rest/agile/1.0/epic/{epicIdOrKey}/issue. You can find more info here:

https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/epic-moveIssuesToEpic

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

Thanks @Alexey Matveev for sharing this, I am a bit surprised that setting the epic link is not supported via normal REST API (fields element updating custom field) as there is not much info about it based on the error here -https://jira.atlassian.com/browse/JSWSERVER-7017 

0 votes
Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

Hello @nik1989

What is the error you see in the response, is the issue created successfully but without the epic link?

nik1989 May 29, 2018

@Tarun Saprayes , issue is created successfully , epic is not linked

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

Is the epic link field available on the edit screen.

nik1989 May 29, 2018

yes the epic link is available on edit screen.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

Strange, could you try doing it on the PUT request as shared by @Alexey Matveev , thus once the issue is created then in the response you should have the issue key and then do a PUT request to update epic link.

nik1989 May 29, 2018

tried that , but response is 404

 

url : https://track-api.com/rest/agile/1.0/epic/TESTPREM3-126/issue

data: {'issues': ['TESTPREM3-133']}

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

404 means - Returned if the epic does not exist or the user does not have permission to view it.

But that doesn't seem to be the case in your scenario as it's the same project. Your request was Put or POST?

nik1989 May 29, 2018

The epic exists as i am able to see it on ui , i made a post request as the document says.

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2018

What's your rest client, could you try the request with couple of different REST clients and see if the error is same, as it could be that you are running into a bug and might need to reach out to Atlassian support.

Pradeep Yadravi August 7, 2018

Hi 
I am also getting same error 404.
my URL is https://jira2.cerner.com/rest/api/2/epic/DEVACDMY-14837/issue

and data is :

{
"fields":{
"summary":"Summary",
"issuetype":{
"name":"Story"
},
"project":{
"key":"DEVACDMY"
},
"description":"Creating the jira for testing"
}
}

And I am using postman for raising the request

 

Please help me 

Thank You 

Suggest an answer

Log in or Sign up to answer