Generate detailed transaction reports
This scenario shows how to generate a report containing the detailed transaction data.
Due to security reasons, only the users with the right use_all_documents_export
can generate this report.
Step 1 - Generate report for all the existing documents
This request returns a report containing the detailed transaction data for all the existing document.
By specifying the property query.scroll.timeout
you initialize searching with a scrolling enabled. The property is a number, that indicates for how many seconds the scroll context should be opened. This value refreshes with each consecutive search scroll request, so there is usually no need to specify more than a few seconds.
Scrolling enables you to traverse big amount of documents (possibly all of them). You can control the amount of returned documents by specifying the query.size
property.
Endpoint
POST /search/reports
Request
POST /search/reports
Content-Type: application/json
{
"query": {
"size": 100,
"scroll": {
"timeout": 10
}
}
}
Response
Note following properties in response object:
scrollId - In response object at position
scrollId
.It may have value of
MbaeA61lkzudLad4R2Jt7TyTq7tMCoNpfeYgiZIT60ssHikp1UiwuOeD2hWayT4K
.
The response contains single "scroll" of the document transactions. To continue with the scrolling, please use the same request and specify the returned scrollId
property.
Step 2 - Scroll through the additional reports
If more reports are available, you can scroll through them using the following request.
Endpoint
POST /search/reports
Request
POST /search/reports
Content-Type: application/json
{
"query": {
"size": 100,
"scroll": {
"id": "MbaeA61lkzudLad4R2Jt7TyTq7tMCoNpfeYgiZIT60ssHikp1UiwuOeD2hWayT4K",
"timeout": 10
}
}
}
Response
Note following properties in response object:
scrollId - In response object at position
scrollId
.It may have value of
RH229HWw1y8vcVXkbM7ZB62S9u8ekiTEs0Jpgxmrmii3ExUpDMFbtYZNOmgoIXd9
.
You can repeat this request to traverse all the document reports.
Step 3 - Generate report for the documents created by a specified user
Using a simple filtering, you can generate a report containing the detailed transaction data for the documents of a specified user only. To do this, you have to specify the user ID. You can also use the from
and size
parameters to limit the number of returned records.
Please note that user ID may differ from the user e-mail address.
Endpoint
POST /search/reports
Request
POST /search/reports
Content-Type: application/json
{
"query": {
"esFilters": {
"bool": {
"filter": [
{
"nested": {
"path": "createName",
"query": {
"term": {
"createName.name": "mary.griffin@circularo.com"
}
}
}
}
]
}
},
"from": 0,
"size": 20
}
}
The response contains the maximum of 20 records for the specified user.
Step 4 - Generate report only for the documents that have been successfully completed
This request returns a report containing the detailed transaction data only for the documents that have been successfully completed.
Endpoint
POST /search/reports
Request
POST /search/reports
Content-Type: application/json
{
"query": {
"esFilters": {
"bool": {
"filter": [
{
"nested": {
"path": "workflow",
"query": {
"term": {
"workflow.shareStateName": "completed"
}
}
}
}
]
}
}
}
}
Step 5 - Generate report only for the documents with transactions
This request returns a report containing the detailed transaction data only for the documents with existing transactions, e.g. documents that have been signed, or shared for a sign.
Documents without transactions (e.g. only created, or created and shared for a view) are not included in the report.
Endpoint
POST /search/reports
Request
POST /search/reports
Content-Type: application/json
{
"query": {
"esFilters": {
"bool": {
"filter": [
{
"nested": {
"path": "workflow",
"query": {
"bool": {
"must": {
"exists": {
"field": "workflow.shareStateName"
}
}
}
}
}
}
]
}
}
}
}