Skip to end of metadata
Go to start of metadata

This is more a workaround than a serious solution. Please consider sponsoring one by buying a subscription.

How to create a report? There are currently two options:

  1. Directly creating a task that will create the report.
  2. Using the Report API via Groovy script embedded in a bulk action.

Option 1: Creating the task that will create the report

We have chosen audit log report with two parameters filled in (fromto).

create-task-with-report.bat
task-with-report.xml

The result from the execution of the above command is:

From the Location header we can determine the OID of the created task - i.e. cfd4220d-ee94-4430-9943-bc658abc9774 in this case.

Option 2: Using Report API from bulk action

For completeness, here we show how to invoke a report via REST service. We have again chosen audit log report with two parameters filled in (fromto).

run-report.bat
run-report.xml

The above bulk action (needs to be run under administrator privileges) creates a task that creates the report. It returns the task, as can be seen from the invocation:

We can learn the OID of the created task (845278af-3225-45da-9834-b2153630b4b8) from the returned XML structure; namely from t:object/apti:output/s:dataOutput/s:item/s:value/@oid.

How to retrieve the report output

We can periodically check for the task completion, e.g. like this

Note that we have to supply correct task OID here.

The result is like this:

The <rext:reportOutputOid>5cf5b277-f867-45e3-a9e0-4f8eccdaa55c</rext:reportOutputOid> element tells us about the resulting report output.

We can retrieve it like this:

(again, please supply correct report output OID there)

The result is like this:

You can now fetch the file (i.e. C:/midpoint/home/scratch/export/Audit logs report 26-10-2018 02-04-03.html) via OS-specific means. In the future we might add REST method to fetch the file using this mechanism.

  • No labels