What should a data export script look like?

You can write scripts to automate the export of the results of Project Tracker queries and reports that you wish to run regularly.

Below we outline an example of using a shell script to drive the "wget" tool to do just that. To execute saved Project Tracker queries and reports from a script using this example code, "wget" must be installed locally. You will also need a working knowledge of Project Tracker, HTML, HTTP, and shell scripting.

If you do not already have saved queries that you wish to execute through a script, you will need to create them. Login to the project through the web interface, then create and save the queries and reports that you'd like to be executed by your script. The scope of the saved queries/reports should be "Personal", and configured such that the results are exported to a MS Excel or TSV file from which they can be easily extracted for analysis by external tools (i.e. a spreadsheet).

You will need the URL of the saved query or report to execute from the script. To get the URLs of saved queries, go to the Saved query list page. To get the URLs of saved reports, go to the Saved report list page. Use your browser's "View page source" function to pull up the raw HTML source view of the page. Then, use your browser's built-in text search function to locate the name of your query in the "source" page. The string follows the pattern <a href="[URL]">[query name]</a>. Copy only the [URL] portion of the string to use in your script for execution of that query or report.

Your script will need to contain commands for the following operations:


Note: Though the example commands above are specific to "wget", the ability to script Project Tracker to export data is not. The listed sequence of operations hold true for any scripting or programming language you'd use to drive an export.
Related questions
What happens when I import artifacts into my project?
What happens when I export artifacts from my project?
What is a Project Tracker namespace?
Related actions
Automate queries with wget
Automate queries with cURL
Run an advanced query
Automate exports with wget
Export artifacts as XML
Import artifacts from XML
Export a saved report
Related reference information
../reference_pt_dtd_explanation.html
More information
More information about wget
More information about cURL