Skip to content
vesse edited this page Sep 26, 2012 · 29 revisions

QA Reports has a RESTful HTTP API for programmatically importing test reports, updating the test cases of an existing report, and merging new result files to an existing report. In addition, QA Reports has some API like features which make fetching report data easier. These are documented in the last section.

Authentication token

A personal authentication token is required for operating with the API. The token can be fetched via QA Reports web UI, by clicking the user name link at the upper right center of the page while logged in.

The API key is shown at the bottom of the User Preferences page:

API Responses

All API methods return with HTTP error codes, mostly accompanied by a JSON payload.

HTTP response codes used are:

Response Description
200 Success
403 Invalid authentication token
404 Report not found
422 Invalid result file(s) or missing required fields

JSON response fields are:

  • ok: either 1 when request was processed without errors, 0 if an error occurred
  • url: URL to created report (only from /api/import) if created succesfully
  • errors: If an error occurred, more information about the error is returned.

Example JSON responses:

  • Import successful: {"ok": "1", "url": "http://qa-reports.meego.com/1.2/Core/Sanity/Cedartrail/3554"}
  • Import failed: {"ok": "0", "errors": {"target": "can't be blank"}}

/api/import

Description: Import test results Method: POST [encoding multipart/form-data]

Parameters:

Parameter name Description Values
auth_token Personal authentication token
release_version Release version 1.0, 1.1, 1.2
target Target profile Core, Handset, Netbook, IVI
testtype Test type Sanity, Acceptance, Basic Feature Testing etc
tested_at Timestamp of the test in format yyyy-mm-dd Optional. If not given, current date is used.
Example value: 2010-12-14
hwproduct Hardware Ia-Russellville, N900, Pinetrail etc
result_files[] Report file in XML format
attachments[] Files to be attached with the report: Screenshots, logs etc Optional
title Report title Optional. Default: value generated from other information if user defined title is not given.
objective_txt Test objective. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.
build_txt Build (image) section content. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.
environment_txt Test environment. Web UI markup can be used. Optional. Default: hwproduct name
qa_summary_txt Quality summary. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.
issue_summary_txt Issue summary. Web UI markup can be used. Optional. Default: value is set from previous report if it exists.

The input can contain multiple result_files[] and attachments[].

Because multiple files can be uploaded, HTTP POST with multipart/form-encoding is used.

An example using cURL for testing the API:

curl \
  --form result_files[]=@sim.xml  \
  --form result_files[]=@bluetooth.xml \
  --form attachments[]=coredump \
  --form auth_token=<your_token> \
  --form release_version=1.2 \
  --form target=Core \
  --form testset=Acceptance \
  --form hardware=N900 \
  http://<server>/api/import

/api/update/<Report_ID>

Description: Update the test cases of an existing report Method: POST [encoding multipart/form-data]

Parameters:

Parameter name Description
auth_token Personal authentication token
result_files[] Report file in XML or CSV format.
Report_ID The ID of the target report

The ID of the target report can be fetched from the URL of the corresponding report page, as shown in the picture below:

The input can contain multiple result_files[].

Because multiple files can be uploaded, HTTP POST with multipart/form-encoding is used.

An example using cURL for testing the API:

curl \
--form result_files[]=@sim.xml \
--form result_files[]=@bluetooth.xml
--form auth_token=<your token>
http://<server>/api/update/<Report_ID>

/api/merge/<Report_ID>

Description: Merge new result files to an existing report Method: POST [encoding multipart/form-data]

Parameters:

Parameter name Description
auth_token Personal authentication token
result_files[] Report file in XML or CSV format.
Report_ID The ID of the target report

The input can contain multiple result_files[].

An example using cURL for testing the API:

curl \
--form result_files[]=@sim.xml \
--form result_files[]=@bluetooth.xml \
--form auth_token=<your token> \
http://<server>/api/merge/<Report_ID>

Because multiple files can be uploaded, HTTP POST with multipart/form-encoding is used.

Notice: Merge API currently sends JSON payload only if errors occurred.

GET APIs

JSON

Report listings

JSON responses can be received from hiearchy level Target profile onwards. Reports listings JSON contains an array of items with fields id, title, and tested_at. JSON response can be received by appeding .json to the URI. For example http://server/1.2/SDK/Basic/Tablet.json could return a response like

[{"id":3243,"tested_at":"2011-08-01T00:00:00Z","title":"Sdk Test Report: Tablet Basic 2011-08-01"},
 {"id":3242,"tested_at":"2011-08-01T00:00:00Z","title":"Tablet Image - Fedora 14 - 1.2.0.90.10.20110726.2"},
 {"id":3241,"tested_at":"2011-08-01T00:00:00Z","title":"Tablet Sysroot - Fedora 14 - 1.2.0.90.10.20110726.2"}]

Single reports

TODO

RSS

QA Reports provides RSS feeds from all hiearchy levels except over all releases, and of course for a single test report. Add /rss to the URI to get the feed. Examples:

  • http://server/1.2/rss
  • http://server/1.2/Core/rss
  • http://server/1.2/Core/Sanity/rss
  • http://server/1.2/Core/Sanity/Cedartrail/rss

If you further append the /rss with /tested_at the RSS feed is sorted by tested_at date instead of the default created_at. Example: http://server/1.2/Core/Sanity/rss/tested_at.

Clone this wiki locally