Tutorial: Reports
Create a Report
API for creating new report:
Request:
curl --request POST \
  --url 'https://{{host}}/v1/reports' \
  --header 'Authorization: Bearer your-token' \
  --header 'Content-Type: application/json' \
  --data '{
  "reportType":"Table",
  "reportName":"User List",
  "reportSql":"select id as userId, firstname as userName from m_appuser where office_id = ${officeId}",
  "reportParameters":[
   {
			"parameterId": 5,
			"reportParameterName": "officeId"
		}
   ]
  }'Response
{
  "resourceId": 1
}Fields detail:
| Field | Description | Comment | 
|---|---|---|
| reportName | Unique name, use run the report | Mandatory | 
| reportCategory | Report category | |
| reportType | Currently possible value are: Table,Pentaho | Mandatory | 
| reportSql | SQL to run in the database. Placeholder and reportParameters must match | Mandatory | 
| reportParameters | parameters to be used during run report | Mandatory if reportSqlContain parameter | 
| description | Description of the report | |
| fileUrl | Url of file that is stored on Mbanq S3 | Mandatory if reportType = Pentaho | 
Get a Report
curl --request POST \
  --url 'https://{{host}}/v1/reports/{reportId}' \
  --header 'Authorization: Bearer your-token' \
  --header 'Content-Type: application/json' \Response:
{
  "id":1,
  "reportName":"AUser List",
  "reportType":"Table",
  "reportCategory":"fetch user list",
  "reportSql":"select id as userId, firstname as userName from m_appuser",
  "coreReport":false,
  "useReport":true
}Run a Report
To run the report please refer to <https://apidocs.cloud.mbanq.com/reference/runreport>
Updated 6 months ago
