# Enduser-driven Business Intelligence (EBI)

Version: 1.0 | Release Date: 3/9/2019

# Get List of FORMAT

Get format list of EBI

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiWidget/reportList?formatType=ebiFormat")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/ebiWidget/reportList?formatType=[formatType]

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
needCount boolean(Query) Optional. Return count of total result rows or not (For page break)
searchText string(Query) Optional. Search input of user (For quick search)
formatType string(Query) Optional. Specific format type (There are three format types : ebiFormat/chart/pivot. M18 APP do not use pivot). If this value is empty, API will get all the ebiFormat/chart format
menuCode string(Query) Optional. Menu code of EBI (If you have got the menu code already)
offset int(Query) Optional. The first return row of the result (For page break)
rows int(Query) Optional. Total count of return rows in the result (For page break)

# Result

Type Location(error_id) Description
success Header Total rows of the result (Only return when needCount = true)
success Body SqlTable as JSON format, contains 4 columns : id, code, desc, formatType

# Report Info

GET Report Info for chosen FORMAT (And Prepare Report Data)

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiWidget/reportDto/127")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

The API returns ReportDto as JSON structured like this:

{
     "formatId": 1, //formatId
	 "formatType": "chart", //formatType
	 "description": "Employee List Chart",  //format description.
	 "contextId": 36518,  //Current Report Context ID
	 "reportTitle": "Report Title",  //Report Title 
	 "table": {TableDto}, //Table Report Dto 
	 "widgets"[{WidgetDto}, {WidgetDto},]  // Array,  all WidgetDto in this report
}

TableDto as JSON structured like this:

{
     "dataSize": 2345, //All Table Data Size, INT
	 "group": true, //IF table has group setting and group data
	 [{columnDto}, {columnDto},]//Array, list all columns
}

ColumnDto as JSON structured like this:

{
     "fieldType": "system", //value=system/udf/udfFormula. The field Type.
	 "dataType": "INT", //value=Auto, NCHAR, NVARCHAR, CLOB, INT,BIGINT, DECIMAL,BOOLEAN,REAL, DOUBLE, TIME, DATE, TIMESTAMP, BLOB, BINARY, OTHER
     "fieldType": "system", //value=system/udf/udfFormula. The field Type.
     "fieldType": "system", //value=system/udf/udfFormula. The field Type.
     "fieldType": "system", //value=system/udf/udfFormula. The field Type.
	 [{columnDto}, {columnDto},]//Array, list all columns
}

WidgetDto as JSON structured like this:

{
     "key": "12346-xudtds-23xuct", //The key of the chart
	 "chartType": "pie", //chart Type
	 "rightfull": true, //If the user has the visit right of the chart
}

# HTTP Request

GET http://[server]/jsf/rfws/ebiWidget/ebiWidget/reportDto/[formatId]

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
formatId long(Path) Required. Specific Format ID
beId long(Query) Optional. Specific Business Entity ID
source string(Query) Optional. The source of current access (For audit only)

# Result

Type Location(error_id) Description
success Body ReportDto as JSON format.

# Report Data

GET Table Report Data

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiWidget/loadReport?formatId=127&rows=10")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/ebiWidget/loadReport?formatId=[formatId]&rows=[rows]

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
contextId long(Query) Optional. Report's contextId (If this value is empty, system will rebuild context and return data)
formatId long(Query) Required. Format ID
beId long(Query) Optional. Business Entity ID, only needed when contextId is empty
source string(Query) Optional. Only needed when contextId is empty
offset int(Query) Optional. The first return row of the result (For page break)
rows int(Query) Optional. Total count of return rows in the result (For page break)

# Result

Type Location(error_id) Description
success Body SqlTable as JSON format

# Chart Widget Data

GET Chart Widget Data

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiWidget/loadChart?formatId=126")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/ebiWidget/loadChart?formatId=[formatId]"

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
contextId long(Query) Optional. Report's contextId (If this value is empty, system will rebuild context and return data)
chartUnit string(Query) Optional. Report's chart key (There are many widgets in ebiFormat. The charUnit is used to specific widget. If charUnit is empty, system will get the result of the first widget)
formatId long(Query) Required. Format ID
beId long(Query) Optional. Business Entity ID, only needed when contextId is empty
source string(Query) Optional. Only needed when contextId is empty

# Result

Type Location(error_id) Description
success Body EChart as JSON format, which is able to initialize Echart

# Make Report data alive

Make Report data alive (Call this web service less than every 4 minutes. EBI modules call it every 3 minutes)

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/q/combSet/keepOpen")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/q/combSet/keepOpen

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
contextId long(Query) Optional. Report's contextId

# Close Report data

Close Report data

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/q/combSet/closeTask")
  .post()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

POST http://[server]/jsf/rfws/q/combSet/closeTask

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
contextId long(Query) Optional. Report's contextId

# Load Query Data

Load Query Data

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiWidget/queryData/QuerySet/348")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/ebiWidget/queryData/[queryType]/[queryId]

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
queryType string(Path) Required. Query type
queryId long(Path) Required. Query ID
beId long[](Query) Optional. Business Entity ID in query
option string(Query) Optional. Report option in EBI, FilterGroupDto as JSON format. Here is a simple example. {"mode":"and","criterias":[{"field":"lastModifyDateFilter","operator":"EQUAL","value":"2023-01-01"},{"field":"createUserFilter","operator":"IN","value":["1", "2"]},{"field":"createDateFilter","operator":"LARGEROREQUAL","value":"2023-01-01"}]}. mode accepts one of the following values: and, or. field is Input Parameter Code in [Query(SQL)], operator accepts one of the following values: EQUAL, UNEQUAL, LARGERTHAN, LESSTHAN, LARGEROREQUAL, LESSOREQUAL, CONTAINS, DOSENOTCONTAIN, IN, NOTIN, STARTWITH, NOTSTARTWITH, ENDWITH, NOTENDWITH.
lookupFilter string(Query) Optional. Turbo Filter in EBI, Map<String, FilterGroupDto> as JSON format
column string[](Query) Optional. Specific the reading columns. If this value is empty, result will contain all the columns.
offset int(Query) Optional. The first return row of the result
rows int(Query) Optional. Total count of return rows in the result

# Result

Type Location(error_id) Description
success Body SqlTable as JSON format

# Load report PDF file

Load report PDF file

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiExport/loadReportAsPDF?ebiFormatId=127")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/ebiExport/loadReportAsPDF?ebiFormatId=[ebiFormatId]

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
ebiFormatId long(Query) Required. EBI format ID
fileName String(Query) Optional. Name of generated file (Do not need the suffix of file)

# Result

Type Location(error_id) Description
success Body Binary stream of the file

# Load report Excel file

Load report Excel file

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/ebiExport/loadReportAsExcel?ebiFormatId=127")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

# HTTP Request

GET http://[server]/jsf/rfws/ebiExport/loadReportAsExcel?ebiFormatId=[ebiFormatId]

# Parameters

Name Type Description
authorization string(Header) Required. Access Token obtained via Oauth2
client_id string(Header) Required. When registered in [OAuth Applications], generated by the M18
ebiFormatId long(Query) Required. EBI format ID
fileName String(Query) Optional. Name of generated file (Do not need the suffix of file)

# Result

Type Location(error_id) Description
success Body Binary stream of the file