cURL command samples

To use cURL commands to execute the Smart Reporting API, familiarize yourself with the sample cURL commands provided in this article.

Important: This document includes references to a third-party product, Postman. The user interface and usage of third-party products are subject to change without notice. For the latest published information about Postman, see the Postman Learning Center.

Download Test Summary Report in PDF format

With Perfecto's Smart Reporting API, you can download the test execution summary in PDF format.

Method API

GET

https://<reporting-server>/export/api/v1/test-executions/pdf?jobName

[0]=<JobName>&jobNumber

[0]=<JobNumber>

The GET request must include the following header:

Header parameter name Parameter value

PERFECTO_AUTHORIZATION

<Your personal security token>

To run the cURL command:

  1. Construct the API URL:

    https://<reporting-server>/export/api/v1/test-executions/pdf?jobName[0]=<JobName>&jobNumber[0]=<JobNumber>

    Parameter

     

    reporting-server

    Reporting server url.

    Example: https://demo.reporting.perfectomobile.com

    Job Name

    CI Dashboard Job Name

    Job Number

    CI Dashboard Job Number

  2. Open a terminal/command prompt.

  3. Run following cURL command. This command generates the result.pdf file in the current directory.

    Copy
    cURL Command
    curl -g -X GET \
    'Reporting API created in step 1'  \
    -H 'PERFECTO_AUTHORIZATION: <Security token>'  \
    -H 'cache-control: no-cache' -o result.pdf

Get details about test cases based on driver ID

With Perfecto's Smart Reporting API, you can get test case details based on filter.

Method API

GET

https://<reporting-server>/export/api/v1/test-executions?filters

filters example - jobName[0], jobNumber[0]

For more details - Smart Reporting Public API

The GET request must include the following header:

Header parameter name Parameter value

PERFECTO_AUTHORIZATION

<Your personal security token>

To run the cURL command:

  1. Construct the API URL:

    https://<reporting-server>/export/api/v1/test-executions?<filter1>[0]=<value>[&<filter2>[0]=<value>]

  2. Open a terminal/command prompt.

  3. Run following cURL command. This command writes the JSON result to the output.txt file in the current directory.

    Copy

    cURL Command

    curl -g -X GET    \ 
    'Reporting API created in step 1'    \ 
    -H 'PERFECTO_AUTHORIZATION: <Security token>'    \ 
    -H 'cache-control: no-cache' > output.txt

Generate an equivalent cURL command from PostMan

In the native app version of postman, you can generate code snippets for API requests, as follows:

  1. In PostMan, click the Code option. You will be asked to select a programming language.

  2. From the options provided, select cURL.

  3. Copy the generated cURL code snippet and paste it into the command prompt.