On this page:

Report

This Web Services allows to get a PDF report using the Report Generator in an asynchronous way. 

The REST API spawns the Report Generator processes, and the REST API is also called back by the Report Generator itself which runs as a REST API client.

See the server resource object and the reportEnabled attribute to check whether these  web services are enabled

A report.properties file allows to configure the interaction between the REST API and the Report Generator:

Report PropertyDescription
report.directory

Set the directory to save PDF reports. This directory must be cleaned up periodically with a "cron" script, using files dates as a criterion.

Example:

report.directory=c:\\temp\\reports

report.reportGenerator

The location of the Report Generator Command line. If this variable is not set then the Web Services are not enabled.

Example:

report.reportGenerator=C:\\Program Files (x86)\\CAST\\ReportGenerator 1.8.0\\CastReporting.Console.exe

report.webServiceURL

The URL to call back the REST API. "localhost" can be used as a domain name, as the REST API server and the Report Generator must share the same host.

Example:

report.webServiceURL=http://localhost:8888/CAST-RESTAPI/rest

report.maxConcurrentProcesses

Set the maximum number of concurrent Report Generator processes to limit the CPU and memory consumption

Example:

report.maxConcurrentProcesses=4

report.maxDelayInSeconds

Set a delay to determine never ending Report Generator processing. After this delay the Report Generator process will be killed.

Example to set a delay of 10 minutes:

report.maxDelayInSeconds=600


URI Templates

HTTP Action

Media TypeURI TemplatesDescription
GETapplication/pdf
{Domain}/Reports?{parameters}

Get a PDF report

Return HTTP Status

  • 201 Accepted: the PDF generation is in progress, or is queued because the number of concurrent Report Generator processes exceeds a limit (see configuration variable).
  • 200 OK: PDF report generation has succeeded, the PDF file is downloaded at attachment or opening a new tab (see inline parameter)
  • 500 Internal Error: PDF generation has failed
  • 503 Service Unavailable: the Report Generator is not enabled

In case of an internal error, the administrator has to

  • Check the REST API log to check whether the issue comes from the REST API configuration (ex: Report Generator is not installed)
  • Check the Report Generator log to check whether the issue comes from the Report Generator (ex: bad template name)
  • Empty the report.directory status file or the whole directory when the issue is resolved

Parameters

URI Parameter

Description

Values

Default value

templateA Report Generator template namea stringN/A
snapshot-idA snapshot ID to identify an application snapshot.an integerN/A
previous-snapshot-idA previous snapshot ID if it is required by the template (Note: immediate previous snapshot ID is deduced by the report generator)an integerN/A
inline

Set "inline" to the "content-disposition" response. The browser will open a popup window to display the PDF content. Otherwise, a file is saved in the "download" directory.

a booleanfalse