How to get Issue History from API for all tickets marked "Done" with custom Ordering?

Ian Heagren August 30, 2018

By trade I'm a Database Dev and haven't done much API work.  I need to access Issue Key, two date fields (begin of in progress, date of when put into "Done"), and another custom field we created.

I need JQL can get me all the issues that are completed/done but to get the actual dates for status changes I need to hit the API. 

I cannot use the db layer.  This will run once a week and I will import into a on-premise db and put a BI tool we have access to on top.

1 answer

1 accepted

1 vote
Answer accepted
NotTheRealStephenSifersNOPENOPENOPENOPE
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.
August 30, 2018

Hey Ian,

On your API URI you would append something like this:

(You will need to find your values for StartDate and DateDone, an API GET call on a sample ticket should give you the fields you need.)

?StartDate>=DATE+AND+dateDone<=DATE+AND+(status=done+OR+status=completed)
Ian Heagren August 30, 2018

Thank you! This is what I was looking for.

NotTheRealStephenSifersNOPENOPENOPENOPE
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.
August 30, 2018

Glad to help, if this helps to answer your question please accept my answer as the solution.

Let me know if you have any more JQL questions as well, always fun to practice.

Ian Heagren August 31, 2018

I'll be doing this in the next couple of days and will mark accordingly.

Ian Heagren September 4, 2018

@NotTheRealStephenSifersNOPENOPENOPENOPE I finally have time to tackle this.

This is part of the api response for one of the fields I need

rest/api/2/customFieldOption/10216","value":"value_here","id":"10216"

How do I incorporate this into the URI call to include as a field?  Also, I'm having a problem trying to find the appropriate dates to include.  Thanks (I'm an API noob, my apologies)

NotTheRealStephenSifersNOPENOPENOPENOPE
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.
September 5, 2018

Hey Ian,

I am presently at Atlassian Summit. I would love to help finish answering this questions for you, but wont be able to respond until next week. Give me a few days and I will follow up.

Thanks for being patient.

NotTheRealStephenSifersNOPENOPENOPENOPE
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.
September 6, 2018

Ok, have a quick minute at the airport to answer thisL

example:

customFieldOption_10216=VALUE 

https://yoursite.domain.com/rest/api/2/search?jql=project=PRONAME+AND+customfield_10216=VALUE

 What is the format of the date you are trying to use? Are you attempting to use JQL to search the datecreate or daterequired fields?

Ian Heagren September 7, 2018

I was browsing the initial API response looking for the dates but could not find them (probably have to expand the nodes somehow).

Here's what my task entails: getting the start time and end time of the ticket (In Progress Timestamp and Done/Completed Timestamp) along with the custom field which is client.  The client is not important, just a field I need to include.  It is across all projects.

NotTheRealStephenSifersNOPENOPENOPENOPE
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.
September 10, 2018

You can place your API call (The URI Value, not the full command) into a browser (ensure your logged into JIRA as an authenticated user) and you should see all of the expanded returns. It will be a lot to go through but that is the easiest way to see the return value.

Suggest an answer

Log in or Sign up to answer