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:

FieldDescriptionComment
reportNameUnique name, use run the reportMandatory
reportCategoryReport category
reportTypeCurrently possible value are: Table , PentahoMandatory
reportSqlSQL to run in the database. Placeholder and reportParameters must matchMandatory
reportParametersparameters to be used during run reportMandatory if reportSqlContain parameter
descriptionDescription of the report
fileUrlUrl of file that is stored on Mbanq S3Mandatory 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