cURL Command Samples

We can use cURL commands to execute the Smart Reporting API. Following are some sample curl commands:

Download Test Summary Report in PDF format

cURL Command

Perfecto's Smart Reporting API provides option to download test execution summary in PDF format.

Method

API

GET

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

[0]=<JobName>&jobNumber

[0]=<JobNumber>

We have to send following header along above request:

Header Parameter Name

Parameter Value

PERFECTO_AUTHORIZATION

<Your personal security token>

Step 1. Construct the URL 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

Step 2. Open Terminal/Command prompt.

Step 3. Run following curl command:

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

The above command will generate result.pdf file in current directory.

Get detail about test cases based on driver id

cURL Command

Perfecto's Smart Reporting API provides option to get test case details based on filter(s):

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

We have to send following header along above request:

Header Parameter Name

Parameter Value

PERFECTO_AUTHORIZATION

<Your personal security token>

Step 1. Construct the API URL:

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

Step 2. Open Terminal/Command prompt.

Step 3. Run following curl command:

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

The above command will write JSON result in output.txt file in current directory.

Generate equivalent cURL command from PostMan:

In Native app version of postman (I used v6.7.2), we have option to generate code snippets for API request.

  1. Click on code option and it will ask you to select programming language:

  2. Select cURL from the options provided below.

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