Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using the API to return only part of a field

hazza96
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 2, 2018

I have been tasked to try and use the API to migrate the open items in two projects on an instance of JIRA 6.2.5 to projects on a JIRA running 7.6.1. I was told that we can't do a data dump because that does not retains the links between parent and child items which we want to keep.

I am looking at the API's, the first step in the script process would be to look at what tickets are currently open and which have links, so:

http://jirahostrest/api/2/search?jql=project=xxxxx&fields=issuelinks

Great, if there are no links I get:

"issuelinks": []

However if there are links I get ALL of the information within the square brackets and I will have to parse it all looking for the bit I want.

What I want to do is only return information with the square brackets when it is not a clone link and I only want it to return the key of the linked item.

So my questions:

  1. Is it possible to do a data dump of open items from 6.2.5 and import them into 7.6.1 in a way that keeps the links?
  2. Is using the API to extract from one system and push it to the other the way to go?
  3. Is it possible to only return a certain element of a section?

None of these work

http://jirahostrest/api/2/search?jql=project=xxxxx&fields=issuelinks:key
http://jirahostrest/api/2/search?jql=project=xxxxx&fields=issuelinks[key]
http://jirahostrest/api/2/search?jql=project=xxxxx&fields=issuelinks.key

 

1 answer

0 votes
Randy
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 2, 2018

1. Yes, see this article on how to structure your CSV.  You will need to do a little bit of data transformation to get it into the structure after you export (or ideally, write a script to export it directly into the expected format)

https://confluence.atlassian.com/jirakb/how-to-import-issue-links-from-a-csv-file-740262715.html

2.  Yes though you could look into k15t's backbone add on which does issue replication across instances also.  Not sure if it'll fit your use case though.

3.  No but there are a plethora of json parsing and querying libraries that will do most of the heavy lifting for you if you are manipulating the responses from the API

Suggest an answer

Log in or Sign up to answer