Last updated at Fri, 22 Sep 2017 16:09:10 GMT
Nexpose provides a number of api methods for report management. Through the API you can create/update a report configuration, generate a report on the fly, and view the status of the generation requests.
A report configuration, in particular, is a configuration for a type of report. With a configuration, a user can specify the template, format, and content for a report. In order to create a configuration via the API a user must generate a ReportSaveRequest.
ReportSaveRequest - The report save request can serve as both a create and update. Below is a sample xml for a create request.
<ReportSaveRequest session- generate-now="1">
<ReportConfig name="test-name12" template- format="pdf">
<Filters><filter type="site" ></Filters>
<Delivery><Storage storeOnServer="0"</Storage></Delivery>
<Generate after-scan="0" schedule="0"></Generate>
</ReportConfig>
</ReportSaveRequest>
</ReportSaveRequest>
Some other thing to note, you can immediately generate a report after saving or updating the configuration by setting the "generate-now" attribute to 1. Another thing to know is that if you wish to update an existing request, simply turn the config-id attribute to an actual configuration id number. The config id number is provided in the response of the save request. Whether it is a save or update request, the config id will always be returned upon sucess. Below is another example of a sample response.
<ReportSaveResponse reportcfg- success="1"/>
ReportGenerateRequest - If you wish to separate generation from config update or creation, then you can use the ReportGenerateRequest. Once a configuration is saved, generating a request specifying the config id can be triggered simply by sending the xml below to nexpose.
<ReportGenerateRequest session- report-/>
Keep in mind that generating a request and getting a response back does not mean that the report has finished generating. In order to know when a report has finished generation, you will need to use the ReportHistoryRequest API and track the status returned. Below is a request/response for report history. Note the status attribute in the response.