diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index 4ead11adc..e381755b6 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -3872,6 +3872,14 @@
+
+
Running a Report
+
This resource allows you to run and receive output from pre-defined Apache Fineract reports.
+
+ The default output is a JSON formatted "Generic Resultset". The Generic Resultset contains
+ Column Heading as well as Data information. However, you can
+ export to CSV format by simply adding "&exportCSV=true" to the end
+ of your URL.
+
If Pentaho reports have been pre-defined, they can also be
+ run through this resource. Pentaho reports can return HTML, PDF or
+ CSV formats.
+
The Apache Fineract reference application uses a
+ JQuery plugin called stretchyreporting which, itself, uses this
+ reports resource to provide a pretty flexible reporting User
+ Interface (UI).
+
Arguments
+
+ - R_'parameter names' ...
+ -
+ optional, No defaults
+
+ - The number and names of the parameters depend on the
+ specific report and how it has been configured. R_officeId is an
+ example parameter name.
+ - Note: the prefix R_ stands for Reporting
+ - genericResultSet
+ -
+ optional, defaults to true
+
+ - If 'true' an optimised JSON format is returned suitable for tabular display of data.
+
- If 'false' a simple JSON format is returned.
+
- parameterType
+ -
+ optional, The only valid value is 'true'. If any
+ other value is provided the argument will be ignored
+
+ - Determines whether the request looks in the list of
+ reports or the list of parameters for its data. Doesn't apply to
+ Pentaho reports.
+ - exportCSV
+ -
+ optional, The only valid value is 'true'. If any
+ other value is provided the argument will be ignored
+
+ - Output will be delivered as a CSV file instead of JSON.
+ Doesn't apply to Pentaho reports.
+ - output-type
+ -
+ optional, Defaults to HTML.
+
+ - Valid Values are HTML, XLS, XSLX, CSV and PDF for html, Excel, Excel 2007+,
+ CSV and PDF formats respectively.
+ - Only applies to Pentaho reports.
+ - locale
+ -
+ optional
+
+ - Any valid locale Ex: en_US, en_IN, fr_FR etc
+ - Only applies to Pentaho reports.
+
+
Example Requests:
+
self/runreports/Client%20Details?R_officeId=1
+
+
+
self/runreports/Client%20Details?R_officeId=1&exportCSV=true
+
+
+
+
+
+GET https://DomainName/api/v1/self/runreports/{reportName}
+
+
+{
+ "columnHeaders": [
+ {
+ "columnName": "Office/Branch",
+ "columnType": "VARCHAR",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "Client Account No.",
+ "columnType": "VARCHAR",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "Name",
+ "columnType": "VARCHAR",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "Joined",
+ "columnType": "DATE",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ },
+ {
+ "columnName": "External Id",
+ "columnType": "VARCHAR",
+ "isColumnNullable": false,
+ "isColumnPrimaryKey": false,
+ "columnValues": []
+ }
+ ],
+ "data": [
+ {
+ "row": [
+ "Head Office",
+ "000000001",
+ "John Doe",
+ "2017-03-04",
+ "786YYH7"
+ ]
+ }
+ ]
+}
+
+
+
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java
index ff83770e9..e13e65246 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java
@@ -24,10 +24,12 @@ import java.util.Map;
import java.util.Set;
import javax.ws.rs.Consumes;
+import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
@@ -82,9 +84,11 @@ public class RunreportsApiResource {
@ApiOperation(value = "Running a Report", notes = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n" + "\n" + "Reports can also be used to provide data for searching and workflow functionality.\n" + "\n" + "The default output is a JSON formatted \"Generic Resultset\". The Generic Resultset contains Column Heading as well as Data information. However, you can export to CSV format by simply adding \"&exportCSV=true\" to the end of your URL.\n" + "\n" + "If Pentaho reports have been pre-defined, they can also be run through this resource. Pentaho reports can return HTML, PDF or CSV formats.\n" + "\n" + "The Apache Fineract reference application uses a JQuery plugin called stretchy reporting which, itself, uses this reports resource to provide a pretty flexible reporting User Interface (UI).\n\n" + "\n" +
"\n" + "Example Requests:\n" + "\n" + "runreports/Client%20Listing?R_officeId=1\n" + "\n" + "\n" + "runreports/Client%20Listing?R_officeId=1&exportCSV=true\n" + "\n" + "\n" + "runreports/OfficeIdSelectOne?R_officeId=1¶meterType=true\n" + "\n" + "\n" + "runreports/OfficeIdSelectOne?R_officeId=1¶meterType=true&exportCSV=true\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=HTML&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=XLS&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=CSV&R_officeId=1\n" + "\n" + "\n" + "runreports/Expected%20Payments%20By%20Date%20-%20Formatted?R_endDate=2013-04-30&R_loanOfficerId=-1&R_officeId=1&R_startDate=2013-04-16&output-type=PDF&R_officeId=1")
@ApiResponses({@ApiResponse(code = 200, message = "", response = RunreportsApiResourceSwagger.GetReportNameResponse.class)})
- public Response runReport(@PathParam("reportName") @ApiParam(value = "reportName") final String reportName, @Context final UriInfo uriInfo) {
+ public Response runReport(@PathParam("reportName") @ApiParam(value = "reportName") final String reportName,
+ @Context final UriInfo uriInfo,
+ @DefaultValue("false") @QueryParam("isSelfServiceUserReport") @ApiParam(value = "isSelfServiceUserReport") final boolean isSelfServiceUserReport) {
- final MultivaluedMap