It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Slow JIRA API

Alex Rose Feb 01, 2014

Hello,

Currently I am using JIRA with Agile( https://www.atlassian.com/software/jira/agile) in order to change a status of a ticket(ex: new, in review, in work, almost done, done, closed, released).

So I created a separate script(php) for parsing a ticket history, that adds to my counter just the time spent for a specific status(ex:in review + in work).

So far I used the API to extract all tickets(+ history) for a specific project from Agile, but, in time, the extraction process costs me a lot of time(for a project with 800 tickets - it takes almost 30 minutes to download all data)

Is there a better way to extract this data faster?
Thank you!

1 answer

0 votes
Peter Toudjarski Feb 02, 2014

Hi Alex,

even if you make it twice faster still as the number of tickets increases the time needed to get ALL tickets will go up. I suggest you don't get ALL the tickets but narrow them down to "in review" and "in work". The REST API supports JQL: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues

Alex Rose Feb 03, 2014

Than you Peter,

But I really need all data downloaded in a separate DB in order to create different reports.
I was just wondering if there is a better way to do this; my approach is:

1. first, I run a curl request in order to get all issues for a specific project:

curl -u 'user:pass' -X POST -H 'Content-Type: application/json' --data '{"jql":"project = '.$project_id.'","startAt":0,"maxResults":1,"fields":["key"]}' 127.0.0.1/search



2. Then, I parse them in batches of 50. For each, I create a new curl request:

curl -u 'user:pass' -X POST -H 'Content-Type: application/json' --data '{"jql":"project = '.$project_id.'","startAt":'.$offset.',"maxResults":'.$step.',"fields":["key", "summary", "issuetype"]}' 127.0.0.1/search";



3. Inside of previous for-each, i create again a new curl request in order to get the issue changelog history

curl -u 'user:pass' -X GET -H 'Content-Type: application/json' 127.0.0.1/issue/{$issue->key}?expand=changelog

Boris Georgiev Feb 04, 2014

I would suggest upgrading the logic in your script to get only issues that were updated and created since the last time the script was run by including "updated" field in your JQL (i.e. updated >= 2014-02-04 AND updated <= 2014-02-05), which will narrow down the results. You just have to remember the date/time the script was run.

I think no solution no matter how fast it is will scale when the issue number increases over time.

Alex Rose Feb 04, 2014

Thank you Boris. I think this should make it faster. For the moment I need only the tickets from last month, so, maybe 50 max per script run.
I really don't know why I am not using already the "updatated" option - perhaps not knowing all api possibilities.

Thanks again.
I will be back with more info as soon as I update the script.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira Software

How to prevent the propagation of unused project schemes, workflows & screens in Jira software

Atlassian ranks project attributes as the third most important factor impacting performance in the category of data. It’s not surprising, since project attributes are precisely the rules used to ma...

1,378 views 1 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you