It's all about the answers!

Ask a question

RTC - Query

Ganesh Veerappan (131) | asked Jan 26 '22, 11:04 a.m.

  Hi ,

I am using RTC for Agile Planning in our projects
I have created a query and i ran that query and i downloaded csv
Now i want to do this operation via .bat file 
how to do it ? this will be helpful for me to run the computation every one when the query gets updated day after day .

Accepted answer

permanent link
Ralph Schoon (62.7k33643) | answered Jan 27 '22, 7:24 a.m.
edited Jan 27 '22, 8:59 a.m.

 This is a Batch file that downloads the CSV file:

@echo off
rem ***********
rem  * Licensed Materials - Property of IBM
rem  * © Copyright IBM Corporation 2007, 2022. All Rights Reserved.
rem  * 
rem  * Note to U.S. Government Users Restricted Rights:  Use, 
rem  * duplication or disclosure restricted by GSA ADP Schedule 
rem  * Contract with IBM Corp.
rem  ***********/
rem set CURLPATH=C:\Development\cURL\curl-7.64.1-win64-mingw\bin
set CURLPATH=C:\Windows\System32
set COOKIES=./cookies.txt
set USER=ralph
set PWD=ralph
set HOST=

rem For JAS Enabled Setup follow guidance from see "%CURLPATH%\curl" -k -c %COOKIES% "%HOST%/authenticated/identity" "%CURLPATH%\curl" -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PWD% "%HOST%/authenticated/j_security_check" "%CURLPATH%\curl" -X GET -k -b %COOKIES% "%HOST%/resource/itemOid/" -o query.csv

Ganesh Veerappan selected this answer as the correct answer

One other answer

permanent link
Ralph Schoon (62.7k33643) | answered Jan 27 '22, 2:47 a.m.
edited Jan 27 '22, 6:37 a.m.

 The first question would be, why you even need to export the data every day. The data is available in the tool and creating a copy does not make so much sense.

There are several possible solutions for this. One solution is, to run the query in the Web UI. There are several actions in the top right menu. One is to download the query as CSV. Another is to the far right, directly left to the dark X called View Full Result Set in Printable Format. Click that button and a new tab opens with the data in HTML. Copy the URL from the new tab. It looks like

Change the media type from text/html to text/csv like so:

If you run that URL in a browser, it performs the download. I believe you should be able to use cURL to automate this. Use RESTClient (Firefox extension) to get the cURL call for 

I don't know how the file download works. The CSV file is in the response. It is likely that cURL allows to save it as a file.

An alternative option would be to use and to use the export capability.

Your answer

Register or to post your answer.