Introduction to Reporting API's
The Report API provides flexibility to users to configure custom reports in the system. This API allows users to define various parameters and criteria to generate reports that meet their specific needs. Users can select the data sources, apply filters, and choose the format in which the report will be delivered. Additionally, the Report API supports scheduling and automation, enabling users to receive reports at regular intervals without manual intervention. With comprehensive documentation and robust functionality, the Report API empowers users to gain valuable insights and make informed decisions based on their customized reports.
Report Response Format
The Report API supports multiple response formats to ensure that users can receive their reports in the most convenient and useful format for their needs. The available response formats are JSON, PDF, and CSV. By default, the report response is provided in JSON format.
JSON Format
- Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy to read and write for humans and easy to parse and generate for machines.
- Usage: Suitable for integrating reports into web applications or further processing in automated systems.
PDF Format
- Description: PDF (Portable Document Format) is a file format that provides an electronic image of text or text and graphics that looks like a printed document and can be viewed, printed, and electronically transmitted.
- Usage: Ideal for creating printable and shareable documents that maintain consistent formatting across different devices and platforms.
CSV Format
- Description: CSV (Comma-Separated Values) is a simple file format used to store tabular data, such as a spreadsheet or database.
- Usage: Perfect for importing data into spreadsheets or other applications that support CSV files, enabling further analysis and manipulation.
Report Parameters
The Report API supports the use of parameters to create dynamic and customizable reports. Parameters allow users to define variable values that can be substituted into the SQL query at runtime, enabling the generation of tailored reports based on specific criteria.
Example SQL with Placeholders:
SELECT * FROM m_savings_account WHERE account_no = '${accountNo}'
Currently the platform accepts the parameter value as number, hyphen(-), comma(,) and dot(.) only.
Predefined Parameters
Currently, only predefined parameters can be used in the reports. To get the list of predefined report parameters, users should call the /reports/template
endpoint.
REQUEST:
curl --request GET \
--url 'https://{host}/v1/reports/template?tenantIdentifier=default' \
--header 'Authorization: Bearer x.x.x-x' \
--header 'Content-Type: application/json'
RESPONSE BODY:
{
"allowedReportTypes":[
"Table",
"Chart",
"Pentaho"
],
"allowedReportSubTypes":[
"Bar",
"Pie"
],
"allowedParameters":[
{
"id":1,
"parameterName":"startDateSelect"
},
{
"id":2,
"parameterName":"endDateSelect"
},
{
"id":3,
"parameterName":"obligDateTypeSelect"
},
{
"id":5,
"parameterName":"OfficeIdSelectOne"
},
{
"id":6,
"parameterName":"loanOfficerIdSelectAll"
},
{
"id":7,
"parameterName":"DefaultSavingsTransactionType"
},
{
"id":8,
"parameterName":"ClientId"
},
{
...more...
}
]
}
Create A Report With Parameter
To create a report with a parameter, we need to provide the parameter id in the parameter object. The report parameter name field need to match the placeholders that are used in the query.
REQUEST BODY EXAMPLE:
{
"reportType":"Table",
"reportName":"GET_SAVINGS",
"reportCategory":"Savings",
"description":"Export data to filter transactions",
"reportSql":"SELECT * FROM m_savings_account WHERE id = '${accountId}'",
"reportParameters":[
{
"parameterId":1004,
"reportParameterName":"accountId"
}
]
}
The parameter id 1004 is a unique id get from /reports/template
api.
Updated 9 months ago