Download an STR via REST API

If you want to be able to automate the process of downloading a single test report (STR) in PDF format via REST API and if you have been wondering how to do it, this article is for you. For presentation purposes, we have used Postman.

For more information, see the related articles at the end of this page.

Step-by-step instructions

  1. Retrieve the <testExecutionId> from the Execution Driver Report ("id" field of the resource), as follows:
    1. The following HTTP GET command is used to get you the "id":
    2. https://<myCloud>.reporting.perfectomobile.com/export/api/v1/test-executions

    3. Add the externalId[0] parameter with a value you can obtain from the testrun itself by using the following line:
    4. Copy
      String externalId = (String) driver.getCapabilities().getCapability("executionId");
      System.out.println("executionId: " + externalId);

      Note:

      You can crosscheck if you have taken the correct ID by opening the report details in the Report Library.

    5. Add the following header parameters to the request:

      Name

      Value

      PERFECTO_AUTHORIZATION

      <Your personal security token>

    6. Run the request. You should receive results such as the following.
  2. With the ID you have obtained, run the API call, as follows:
    1. To download the result from a single test execution, use the following HTTP GET command:

      Copy
      https://<myCloud>.reporting.perfectomobile.com/export/api/v1/test-executions/pdf/<testExecutionId>
    2. Add the following header parameters to the request:

      Name

      Value

      PERFECTO_AUTHORIZATION

      <Your personal security token>

    3. Execute the call to download the PDF report.

    4. Save the file.

    5. Open the pdf with your reader of choice:

If you need help with any of these steps, contact  Perfecto Support.

Also in this section

Related Articles