Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,367,206
Community Members
 
Community Events
168
Community Groups

how to create the epics that are associated with issuelinks ? through restapi/2

i am trying with few subsequent calls in order be EPICS - story - task - bug 

/rest/api/2/search?jql=project=XXXX%20and%20issuetype=%22Epic%22&startAt=0&maxResults=400"

 

/rest/api/2/search?jql=project=XXXX%20and%20issuetype=%22story%22&startAt=0&maxResults=400"

 

/rest/api/2/search?jql=project=XXXX%20and%20issuetype=%22task%22&startAt=0&maxResults=400"

 

/rest/api/2/search?jql=project=XXXX%20and%20issuetype=%22bug%22&startAt=0&maxResults=400"

 

 

approach1: 

here how can i ignore issuelink and create them after the bug calll 

or 

approach 2: 

how can i create epics first without issuelinks and attach them later? 

 

pr any alternative approach ? 

pl advise

1 answer

0 votes

Hi @Sashank 

What are you trying to do ? You call are just jql search ?

You should not use link to manage epics and story as it's how it used in the background, in the foreground you should use Epic Link and Epic Name.

EPic Name is the name of the EPic, it's a field

Epic link is the reference from the task under the EPic, it's a field also.

 

You can create an Epic then link any issue to it by updating the issue and set the epic issue key as Epic Link value for the field using the API.

 

Regards

Hi @Florian Bonniec 

Here i am trying to migrate all the issues from one instance to another instance . 
so trying to create epics first where i see the issuetype:story as well coming in through linkedissues. So during a get call as i am grabbing the issue id values into variables from old instance and making a post call for creating issues onto new instance. But for as these issuetypes of story is coming up my post call fails by throwing no epic found error as linked issue is coming ahead of the epic in post call execution. 
so i m looking a way to dodge this issue or follow any alternative & better approach ? 

I think you should create Epics, get a mapping with the old and new key then create stories without any epic link and keep populate the mapping old/new Key. Then once everything is imported, go over all issues in the source instance that have an Epic Link value and update the associate one in the new instance with the new epic link you should have in your mapping table.

Are you migratin the whole instance or just project by project ? You may have Stories linked to epics from another project if you choose the second option.

So here inwas following that approach as you suggested above but during my get call on epics i am  recieving the issuelinks(linkedissues) too which inwanted to skip and recieve only epics. 
so i am looking for a way to get only epics and not linked issues. 
can you suggest ? 

And Here I am trying to migrate project by project

Can you clean the json you receive and remove the link issue part ?

So you sould get all issues, remove issue link part and epic link field. Once imported you update all issue with the links and epic link this time.

Be aware that Epic <> Stories relation is not a link for JIRA, the association is done using the "Epic Link" field.

 

You will have issue and have to clean the json you receive if you do project by project because you will always have issue link to an issue in another project or a story under an epic in another project.

Okay . Got it and alternatively insted ogf cleaning the json i am looking for the jql which can get only epics/stories/tasks without the linked issues   And subsequent call with jql to get these linkedissues 

Not really, because if you query issue without link, import all of them then all issues with links you will have the same issue because if issue A is linked to B any of your query will return A nor B because A as a link with B and B as a link with A.

 

There is also some apps on the market place that may help you and can be worse to evaluate such as configuration manager.

Understood . So the ideal choice would be to clean the json to pull only issues first and then linked issues ? Whether it might be epic /story or any issuetypes ? 

Right, it's how I would do it, clean the Json response or build a new Json from the response to create the new issue.

 

This link may be interested to you too.

https://confluence.atlassian.com/adminjiraserver/importing-data-from-json-938847609.html

Suggest an answer

Log in or Sign up to answer