Reporting service
The Reporting service enables you to generate reports and obtain information about 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, a PDF file, or an Excel (.xlsx) 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
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, one of the following:
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 |
[configuration file] | 9.0.20.000 (Optional) JSON file that contains additional, customized parameters (for example, date and time formats and new filter values). For more information about the configuration file and the settings that you can include within it, see Reporting-configuration. |
The following example shows a typical CLI command and response:
{
"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'
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, a PDF file, or an Excel (.xlsx) 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
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, one of the following:
Default value: csv |
[configuration file] | 9.0.20.000 (Optional) JSON file that contains additional, customized parameters (for example, date and time formats and new filter values). For more information about the configuration file and the settings that you can include within it, see Reporting-configuration. |
The following example shows a typical CLI command and response:
{
"reportId": "52ddeded-7234-4ec3-8588-945db0f961c0",
"name": "Alerts_1",
"format": "pdf",
"status": "PROCESSING",
"url": ""
}
REST API Syntax
See REST API reference.
Example using curl:
-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
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:
{
"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:
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 APIcurl -H "Authorization:Bearer $token" -O $download_urlThe -o option downloads the report to a directory and file that you specify.
REST APIcurl -H "Authorization:Bearer $token" -o $report_path $download_url
Retrieving report filter definitions (reporting reportFilters::get)
The reporting reportFilters::get command enables you to obtain a list of all filters defined in a report, in JSON format.
You can use the output of this command as the starting point for updating filter values — edit filter values and then submit your list using the API command for generating a report.
For more information, see Filter values in Reporting-configuration.
CLI Syntax
where <report_name> is the name of the Control-M report.
REST API Syntax
See REST API reference.
Example using curl:
-H "Content-Type: application/json" \
-X GET "$endpoint/reportFilters/$report_name"