Reporting service

The Reporting service enables you to generate reports that were set up through Control-M Reports. You can generate reports either synchronously or asynchronously.

NOTE: To generate a report through the Control-M Automation API, the user running the command must be the same as the Control-M/EM user who created the report in Control-M Reports.

Synchronous report generation (reporting report::get)

The reporting report::get command enables you to generate a report synchronously. In the command, you specify the name of the report, as set up in Control-M Reports. For the report format, you can choose between a CSV file or a PDF file. In the command response, you receive a URL for accessing the report through a browser. You can also choose to download the report to a file.

CLI Syntax

CLI
ctm reporting report::get <report_name> [format] [-o <file_path>]

Where:

Parameter

Description

<report_name>

Name of the Control-M report

NOTE: The report name that you specify cannot contain special characters. For example, if the name of the report contains a space character, use %20 in the API command, instead of the space character.

If the report is shared, add shared: before the name.

[format]

(Optional) The format of the report, either csv or pdf

Default value: csv

<file_path>(Optional) The full path to the file that you want to create, if you want to download the report to a file

The following example shows a typical CLI command and response:

> ctm reporting report::get Alerts_1 pdf -o C:\BMC\test.pdf
{
  "reportURL": "http://VW-C363:18080/RF-Server/Alerts_1_8d1a2cd5-62f3-4823-b1ab-4da67ab66237.pdf"
}
Downloading 'http://VW-C363:18080/RF-Server/Alerts_1_8d1a2cd5-62f3-4823-b1ab-4da67ab66237.pdf'
into 'C:\BMC\test.pdf'

REST API Syntax

See REST API reference.

Note

Synchronous generation of reports through a REST API command will be deprecated soon. Use the asynchronous option (the reporting report and reporting status::get commands) instead.

In the following curl example, report format is set to pdf through a query parameter:

REST API
curl -H "Authorization: Bearer $token" $endpoint/reporting/report/$report_name?format=pdf

This curl command returns a download URL for the report.

Asynchronous report generation (reporting report)

The reporting report command enables you to send a request to generate a report asynchronously. In the command, you specify the name of the report, as set up in Control-M Reports. For the report format, you can choose between a CSV file or a PDF file.

The command response provides a summary of basic report statistics and generation status, including a report ID that you can use to check the status of asynchronous report generation (using the reporting status::get command).

CLI Syntax

CLI
ctm reporting report <report_name> [format]

Where:

Parameter

Description

<report_name>

Name of the Control-M report

NOTE: The report name that you specify cannot contain special characters. For example, if the name of the report contains a space character, use %20 in the API command, instead of the space character.

If the report is shared, add shared: before the name.

[format]

(Optional) The format of the report, either csv or pdf

Default value: csv

The following example shows a typical CLI command and response:

> ctm reporting report Alerts_1 pdf
{
    "reportId": "52ddeded-7234-4ec3-8588-945db0f961c0",
    "name": "Alerts_1",
    "format": "pdf",
    "status": "PROCESSING",
    "url": ""
}

REST API Syntax

See REST API reference.

Example using curl:

REST API
curl -H "Authorization: Bearer $token" \
-H "Content-Type: application/json" \
-X POST -d "{"name": "Alerts_1", "format": "pdf"}" \
"$endpoint/reporting/report"

Get report status (reporting status::get)

The reporting status::get command enables you to check the status of report generation for a report that you requested asynchronously (using the reporting report command). You identify the report by specifying its report ID.

The command response provides a summary of basic report statistics and generation status. If report generation has completed successfully, you receive a URL for downloading the report.

CLI Syntax

CLI
ctm reporting status::get <reportID>

Where <reportID> is the report ID that you received when you requested asynchronous generation of the report using the the reporting report command.

The following example shows a typical CLI command and response:

> ctm reporting status::get 52ddeded-7234-4ec3-8588-945db0f961c0
{
    "reportId": "52ddeded-7234-4ec3-8588-945db0f961c0",
    "name": "Alerts_1",
    "format": "pdf",
    "status": "SUCCEEDED",
    "url": "http://server1:18080/RF-Server-Files/52ddeded-7234-4ec3-8588-945db0f961c0.pdf"
}

REST API Syntax

See REST API reference.

Example using curl:

REST API
reportID="52ddeded-7234-4ec3-8588-945db0f961c0"
curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" \
-X GET "$endpoint/reporting/status/$reportID"

After receiving the URL for the report, you have the option of running a second curl command to download the report from the specified download URL to a file. For the location of the file, you can choose from the following options:

  • The -O option downloads the report to a file in the current directory (from which you ran curl).

    REST API
    curl -H "Authorization:Bearer $token" -O $dowload_url
  • The -o option downloads the report to a directory and file that you specify.

    REST API
    curl -H "Authorization:Bearer $token" -o $report_path $dowload_url
Was this page helpful? Yes No Submitting... Thank you

Comments