How can I export to CSV the results of a search via the REST API?

Anibal Jodorcovsky April 8, 2023

I'm connecting to a Jira server with version v8.22.3#822003.

I'm doing this search:

https://informs.infoway-inforoute.ca/issues/?jql=%22Batch%20ID%22%20~%20BSCT-18060

And this search gives me a list of tickets. From there, I'm currently doing the following:

* Manually selecting the Export pull-down menu

* Selecting CSV (all fields)

 

I'd like to do the above via REST API to automate it. I can login and get a ticket via the REST API (using jiraone in Python). But I can't find what's the endpoint and payload to be able to download the result of a search.

2 answers

1 vote
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2023

Hi @Anibal Jodorcovsky  Welcome to Atlassian Community!

You can export REST API data into CSV using MS Excel. 

REST API result in JSON, you can convert JSON data into csv OR you can use below method to get JQL Data directly into csv. Any changes in JIRA Issue also get reflected in Excel file, no need to export again or run API again. 

Open MS Excel --> Select Data tab >> Select Data Source >> From Web >> Enter URL :- https://informs.infoway-inforoute.ca/issues/?jql=%22Batch%20ID%22%20~%20BSCT-18060 >> Press OK >> Enter Basic Auth or Web API token >> Power Query Editor will Open >> Click "List" >> Records will open >> Click "Into Table" >> Select Column/Fields which you want to add into your excel >> Press "Save & Close". 

Use Basic or web API.pngPaste URL Press OK.pngScreenshot 2023-04-09 121019.pngScreenshot 2023-04-09 121157.png

Anibal Jodorcovsky April 9, 2023

The thing is that I need to do some more postprocessing on the CSV file, so this Excel trick, although nice to know, does not help me. Once I get the CSV file (or xlsx file) I need to run some business logic on values obtained, and then update some other database we have. 

 

So, is there a way for me to be able to basically do what the image below does in the UI?

jiracsv.jpg 

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 9, 2023

@Anibal Jodorcovsky This Excel trick save your time, and you don't need to export JIRA into csv again and again. Map only your projects fields in column. This is a one time setup, next time you only need to click refresh data.

Above Screenshot feature is only available in JIRA. Using REST API you get data in json format. For CSV convert data into csv.

Anibal Jodorcovsky April 9, 2023

But I can't use Excel. My program is all in Python and I need to extract this information from Python, not from Excel.

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 9, 2023

Then you have to write a code in Python which convert JSON response into CSV. 

I don't have experience in python, you can wait for other community member response, someone definitely know about this issue.

0 votes
Anibal Jodorcovsky April 9, 2023

This is weird. I have an email with another answer, which is correct, but I don't see it online when logging in to the website. Why would that be?

Aditya Srikanth December 11, 2023

Anibal Jodorcovsky can you plz post the correct answer here? I'm also having the same requirement. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events