Skip to content

Commit

Permalink
REST docu, report data examples and example pages
Browse files Browse the repository at this point in the history
  • Loading branch information
matusmacik committed Mar 8, 2024
1 parent b5d87b8 commit be6d125
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/interfaces/rest/endpoints/report-data.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Get operation for fetching a single specific object.

Search operation usable for fetching the full list of objects or a list based on filter.

include::../operations/examples/raw/search-all.adoc[]
include::../operations/examples/raw/search-report-data-from-report-def.adoc[]

- xref:/midpoint/reference/interfaces/rest/operations/search-op-rest/[Search Operation]

Expand Down
13 changes: 12 additions & 1 deletion docs/interfaces/rest/operations/examples/create-get-report.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
== Description

The example describes a use-case when we want to create a new report definition, execute the task to create a new
report and then download the resulting report.
report and then fetch a report data object witch contains the file path to the report data.

1. You have to create the new report definition, for this we use the example "Create a new Report regarding Error audit records in 24h".
2. Based on the example "Create a new Task for Report Execution" a new task referencing the report definition is created and the report data is generated.
3. A filter is used to fetch the report data, we use the query in the example "Search Report Data based on Report Reference".
4. The report data contains the file path which we then can use to fetch the actual report CSV from the file system.
// TODO Should we implement some action which returns the bytestream of the csv based on the report data oid or smthing ??

.Authentication methods used to work with the REST api
xref:/midpoint/reference/interfaces/rest/concepts/authentication/#_basic_authentication[Authentication methods]
Expand All @@ -21,8 +27,13 @@ For some help regarding the REST examples please see this link:

xref:/midpoint/reference/interfaces/rest/concepts/using-rest-examples.adoc[How to use MidPoint REST examples]


include::../examples/raw/create-report.adoc[]

include::../examples/raw/create-task-report.adoc[]

include::../examples/raw/search-report-data-from-report-def.adoc[]


== See Also

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
:page-visibility: hidden

.*Search Report Data based on Report Reference*
[source,bash]
----
curl --user administrator:y0uR_P455woR*d \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST http://localhost:8080/midpoint/ws/rest/reportData/search \
-v \
--data-binary @./samples/rest/query-report-data.json
----

.*Show* data source example for *"Search Report Data based on Report Reference"* | link:https://raw.githubusercontent.com/Evolveum/midpoint-samples/master/samples/rest/query-report-data.json[GitHub]
[%collapsible]
====
[source, json]
----
{
"query": {
"filter": {
"text": "reportRef/@/name =\"All error audit records in 24h\""
}
}
}
----
====
The response is an HTTP 200 code in case of success with a response body containing the queried items.
.Example Output is a list of objects.
[%collapsible]
====
[source, json]
----
{
"@ns" : "http://prism.evolveum.com/xml/ns/public/types-3",
"object" : {
"@type" : "http://midpoint.evolveum.com/xml/ns/public/common/api-types-3#ObjectListType",
"object" : [ {
"@type" : "c:ReportDataType",
"oid" : "1a1f8226-6b2d-4253-8714-f0a8e61179fb",
"version" : "1",
"name" : "All error audit records in 24h-EXPORT 08-03-2024 08-18-46.230 - CSV",
"description" : "Report made from all audit records. - CSV",
"metadata" : {},
"operationExecution" : {},
"iteration" : 0,
"iterationToken" : "",
"filePath" : "./foo/baar/All_error_audit_records_in_24h-EXPORT_08-03-2024_08-18-46.228.csv",
"reportRef" : {
"oid" : "579b3765-a2d3-46bc-98e5-3a2414d0accd",
"relation" : "org:default",
"type" : "c:ReportType"
},
"nodeRef" : {
"oid" : "3f383096-0da2-42f5-97d5-cdc2da0f61db",
"relation" : "org:default",
"type" : "c:NodeType"
}
} ]
}
}
----
====

0 comments on commit be6d125

Please sign in to comment.