Generate and Download Reports using Open API

QTM4J allows its users to generate report data and download it in an Excel file using the Open API.

The flow of the functionality:

  1. The user will create a filter with all the required parameters from the Test Report module.

  2. The user will copy the filterId from the report UI.

  3. The user will pass the filterId in the API request, based upon which the report will be generated accordingly.

  4. The API will provide the task details with the progressUrl in the response.

  5. After sending the request using the progressUrl, a link for the Excel file will be provided.

Notes:

  • Once a report is exported using the API, users have to wait for 15 minutes to export the report for the same filter.

  • A maximum of 10000 records can be exported in a single request of API.

Required Permission: Users should have permission for the Test Report module.

Headers:

  • Authentication: Provide API Key here. Generate your API Key for authentication from QMetry > Configuration > Open API. Refer to this article for the detailed steps.

Option

Value

Option

Value

URL

https://qtmcloud.qmetry.com/rest/api/latest/gadgets/{filterId}/export-report

Method Type

POST

Request Body*

{ "startAt":1, "includeTestSteps":true }

*Request Body Parameters

Parameters

Description

Default Value

Parameters

Description

Default Value

startAt

For the paginated data, mention the row number from where the report data should be exported.

A maximum of 10000 records can be exported in a single request of API. If there are more that 10000 records in the report, you can use the startAt parameter accordingly to cover all the records in the export.

For example, there are 15000 records in the report. You can export the records in two API requests.

First Request → “startAt”: 1

Second Request → “startAt”: 10001

0

includeTestSteps

Mention “true” if you want to include test steps data in the exported report.

false

 

Steps

Step 1. Obtain the “filterId” from the Test Report module.

The REST API URL is https://qtmcloud.qmetry.com/rest/api/latest/gadgets/{filterId}/export-report

For example, if the filterId is 918 then the URL will be https://qtmcloud.qmetry.com/rest/api/latest/gadgets/918/export-report

Note: If the filter criteria are modified afterward, the filterId remains the same and will not change.

How to obtain the “filterId” from UI

1. Open the Test Report module.

2. Access the saved filter of the report.

3. Click on the Copy icon adjacent to the Filter drop-down.

 

Step 2. Send the API request using the URL with the POST method.

You will receive the progressUrl in response to the request.

Step 3. Send the API request with the progressUrl using the GET method to get the link for the Excel file.

Step 4. Copy the URL that you received in response in the browser.

The report data gets exported into an Excel file. The file contains all the fields of the report as per the configuration of the saved filter.

View the Status

The file link will expire in 24 hours.

Click the Background Processes icon at the top.

You can view the status of the process on the Notifications panel.