Displaying the Data in a Graph

If you go to the Reports center in SpiraTeam, you can display various graphs:

When you choose the option to Download Data as CSV, the web browser makes a request to get the data as a CSV file. Sometimes users want to be able to extract that data programmatically for use in a web portal or other application.

Extracting the Graph CSV Data

The URL that will be sent to the server to get this data is of the format:

http://server/SpiraTeam/1/Graph/7/Download.aspx?artifactTypeId=1&groupByField=RequirementStatusId&xAxisField=ImportanceId&cultureName=en-US

The components of the URL are:

  • Base URL - in this example it is http://server/SpiraTeam, for on-premise customers it would be the server name and the virtual directory (typically SpiraTeam, SpiraTest or SpiraPlan). For cloud hosted customers it would typically be https://myinstance.spiraservice.net
  • Project and Graph - the /1/Graph/7/Download.aspx is basically the ID of the project and the ID of the graph type. Normally it would be /{project_id}/Graph/{graph-id}Download.aspx
  • artifactTypeId - This is the ID of the artifact (1 = Requirement, 2 = Test Case, 3 = Incident, 4 = Release, 5 = Test Run, 6 = Task, 8 = Tets Set)
  • groupbyField - This is the field you want to group by
  • xAxisField - This is the field you want for the x-axis
  • cultureName - this should be set to the language you're using, in this example it is en-US (US English)

If you are not sure of the values, open up the Web Browser in Developer mode (e.g. press F12). Then open up the Net tab and you will see all the HTTP requests from the browser.

Clear this log and click on the ' Download Data as CSV'. You will see the appropriate call in the tab: