反馈已提交
网络繁忙
FineBI is a browser/server mode based on B/S architecture. Currently, the system developed by users basically tends to the browser/server mode of B/S architecture. Therefore, some pages can be integrated directly by the simple way of embedded integration of Web pages.
Through integration, users can access FineBI's server from their own system through a link using a browser, thereby calling FineBI's Web page in their own system.
There are two ways to integrate:
Use URL link directly
Call JSON through JS to obtain the analysis template.
This chapter provides the URL link interface of each part and the API in JSON format.
FineBI is generally divided into two steps in embedded integration: obtaining Tokens and calling other related APIs. For details, please refer to: Web page simple integration example.
Note 1: due to platform security restrictions, FineBI needs to turn off security headers in "management system > security management > security protection" during integration to cross domain.
Note 2: the following interfaces support cross domain, and the return values of cross domain and non cross domain are consistent.
Function: use this interface to create a new dashboard
URL:/v5/api/platform/dashboard/reports?dir=xxx
Request mode: GET
Parameter description:
Request example:localhost:37799/webroot/decision/v5/api/platform/dashboard/reports?dir={"name":"New dashboard12","catalog":["New folder"]}
Return data example:
{ "success": true, "code": "200", "message": "success", "data": { "id": "72b579f34fef4982b53c723170de60cb", "name": "New dashboard12", "folder": false, "initTime": 1593312632150, "lastUpdateTime": 1593312632150, "shared": false, "pId": "898b2dcdc6e145d38958aa304d11c362", "createBy": "b5f0c2ee-640f-4039-a4d4-918b55354898", "hangout": "NORMAL", "publicLink": { "shared": false, "uri": null, "reportId": "72b579f34fef4982b53c723170de60cb", "userId": null }, "mountedDirIds": [], "applyTime": 0 }, "errorCode": null, "detailErrorMsg": null, "errorMsg": null}
Function: by calling this interface, the user can delete the created dashboard
URL:/v5/api/platform/dashboard/report?info=xx
Request example:localhost:37799/webroot/decision/v5/api/platform/dashboard/report?info={"folder":false,"reportId":"d5a78c3fc1f643059f02ff43fbdd44a9"}
If successful, return data:
{ data:true}
If it fails, return data:
{ errorCode:xxx errorcode}
Function: by calling this interface, the user can modify the name of the created dashboard.
URL: /v5/api/platform/dashboard/rename?info=xx
Request method: GET
Request example:
localhost:37799/webroot/decision/v5/api/platform/dashboard/rename?info= {"name":"新建儀表板","newName":"數據分析","reportId":"d5a78c3fc1f643059f02ff43fbdd44a9"}
Function: use this interface to save another dashboard
URL: /v5/platform/dashboard/saveas
Example of successful data return:
code: "200"data: {id: "d07aeebaa6244d7c984cac0cd1f7c32a", name: "New dashboard61", folder: false, initTime: 1557801373662,…}applyTime: 0createBy: "b5f0c2ee-640f-4039-a4d4-918b55354898"folder: falsehangout: "NORMAL"id: "d07aeebaa6244d7c984cac0cd1f7c32a"initTime: 1557801373662lastUpdateTime: 1557801371510mountedDirIds: []name: "New dashboard61"pId: "b5f0c2ee-640f-4039-a4d4-918b55354898"publicLink: {shared: false, uri: null, reportId: "d07aeebaa6244d7c984cac0cd1f7c32a", userId: null}shared: falsedetailErrorMsg: nullerrorCode: nullerrorMsg: nullmessage: "success"success: true
Note: the returned data.id is the template ID, and template information is obtained according to the template ID.
Example of returning failed data: (judge whether the template name is duplicate according to errorCode)
code: "200",message: "success",data: [ ],success: false,errorCode: "61310032",detailErrorMsg: null,errorMsg: "ReportIndex{name='20190117111140448_10813', folder=false, initTime=1557802945315, lastUpdateTime=155780
Function: detailed data information of the corresponding directory under my (current login) dashboard (including folders and dashboards)
URL:/v5/api/platform/dashboard/list?dir=xxx
dir={"catalog":["New folder"],"reportId":"7e6382e9fe5448b38bb0bc3f50913b5d"}
Note: reportId is the directory id; If it is the root directory, the reportId is urserId
Note: because the URL in FineBI passes the JSON object, if some servers do not support the JSON URL, it is necessary to encode the dir value encodeUPIComponent(). Refer to Section 4.1 of this article for details.
Request example:localhost:37799/webroot/decision/v5/api/platform/dashboard/list?dir={"catalog":["New folder"],"reportId":"7e6382e9fe5448b38bb0bc3f50913b5d"}
{ "code": "200", "data": [ { "applyTime": 0, "createBy": "b5f0c2ee-640f-4039-a4d4-918b55354898", "folder": false, "hangout": "NORMAL", "id": "0ba9d9496aee4bba95fcf60d78473115", "initTime": 1539157863240, "lastUpdateTime": 1539157863241, "mountedDirIds": [], "name": "New dashboard12", "pId": "d5a78c3fc1f643059f02ff43fbdd44a9", "publicLink": { "reportId": "0ba9d9496aee4bba95fcf60d78473115", "shared": false, "uri": null, "userId": null } }, { "applyTime": 0, "createBy": "b5f0c2ee-640f-4039-a4d4-918b55354898", "folder": false, "hangout": "NORMAL", "id": "7e6382e9fe5448b38bb0bc3f50913b5d", "initTime": 1539157797060, "lastUpdateTime": 1539157797061, "mountedDirIds": [], "name": "New dashboard", "pId": "d5a78c3fc1f643059f02ff43fbdd44a9", "publicLink": { "reportId": "7e6382e9fe5448b38bb0bc3f50913b5d", "shared": false, "uri": null, "userId": null } } ], "detailErrorMsg": null, "errorCode": null, "errorMsg": null, "message": "success", "success": true}
Function: use this interface to obtain template related information. Input: template ID and creator ID; Return: template information
URL:/v5/api/platform/dashboard/reports/info?info=xxx
Request example:localhost:37799/webroot/decision/v5/api/platform/dashboard/reports/info?info={"index":[ { "id":"7e6382e9fe5448b38bb0bc3f50913b5d" }] }
{ "code": "200", "data": { "index": [ { "createBy": "1", "folder": false, "id": null, "initTime": 1539157797060, "lastUpdateTime": 1539157797061, "name": "New dashboard", "pId": "d5a78c3fc1f643059f02ff43fbdd44a9" } ] }, "detailErrorMsg": null, "errorCode": null, "errorMsg": null, "message": "success", "success": true}
1)json format
Role: all users with template management node permissions.
URL:/v5/api/dashboard/search?page=1&count=30
method:GET
{ "data": { "reportIndexList": [{ "userInfo": { "displayName": "3(3)", "postNames": ["research and development"], "departmentNames": ["A"], "customRoleNames": null, "departmentPosts": [{ "jobTitle": "research and development", "departments": "A" }] }, "reportIndex": { "name": "2312312", "folder": false, "initTime": 1537768891437, "lastUpdateTime": 1538032909917, "id": "5b5105c7f28547209cc50c5a23c3ebe6", "pId": "8a1462058954493ead2c7cb8e63bc7ec", "createBy": "80a56476-7ade-4b71-9c38-a365a9df591d", "hangout": "NORMAL", "publicLink": { "shared": false, "uri": null, "reportId": "5b5105c7f28547209cc50c5a23c3ebe6", "userId": null }, "mountedDirIds": [], "applyTime": 0 } }, { "userInfo": { "displayName": "1(1)", "postNames": null, "departmentNames": null, "customRoleNames": ["superusers"], "departmentPosts": null }, "reportIndex": { "name": "New dashboard1", "folder": false, "initTime": 1537768667041, "lastUpdateTime": 1538032909810, "id": "af0835a860c1460da5d78f5a871ccc05", "pId": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "createBy": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "hangout": "NORMAL", "publicLink": { "shared": false, "uri": null, "reportId": "af0835a860c1460da5d78f5a871ccc05", "userId": null }, "mountedDirIds": [], "applyTime": 0 } }, { "userInfo": { "displayName": "1(1)", "postNames": null, "departmentNames": null, "customRoleNames": ["superusers"], "departmentPosts": null }, "reportIndex": { "name": "New dashboard", "folder": false, "initTime": 1537768614423, "lastUpdateTime": 1538032909774, "id": "b63ae18862c0424d983865cbaa0dc7c4", "pId": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "createBy": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "hangout": "NORMAL", "publicLink": { "shared": false, "uri": null, "reportId": "b63ae18862c0424d983865cbaa0dc7c4", "userId": null }, "mountedDirIds": [], "applyTime": 0 } }], "applyingCount": 0, "totalCount": 3 }}
2) Visual interface
URL: dashboard/management
Function: use this interface to obtain all the details of the current user. Currently, it includes departments, roles, users and reports.
URL:/v5/api/dashboard/user/info
{ "data": { "userInfo": { "displayName": "1(1)", "postNames": null, "departmentNames": null, "customRoleNames": ["superusers"], "departmentPosts": null }, "dashboards": [{ "name": "New dashboard", "folder": false, "initTime": 1537768614423, "lastUpdateTime": 1538032909774, "id": "b63ae18862c0424d983865cbaa0dc7c4", "pId": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "createBy": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "hangout": "NORMAL", "publicLink": { "shared": false, "uri": null, "reportId": "b63ae18862c0424d983865cbaa0dc7c4", "userId": null }, "mountedDirIds": [], "applyTime": 0 }, { "name": "New dashboard1", "folder": false, "initTime": 1537768667041, "lastUpdateTime": 1538032909810, "id": "af0835a860c1460da5d78f5a871ccc05", "pId": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "createBy": "53968b8b-14f4-4ec1-b9e0-347b1105af2d", "hangout": "NORMAL", "publicLink": { "shared": false, "uri": null, "reportId": "af0835a860c1460da5d78f5a871ccc05", "userId": null }, "mountedDirIds": [], "applyTime": 0 }] },}
9. Cancel sharing
Function: by calling this interface, the user can cancel the dashboard sharing of a user pair.
Cancel sharing a template, a user:
URL: /v5/api/dashboard/share/user/rejection/result?entityId=a,b,c&userId=1,2,3
Cancel sharing multiple templates, multiple users:
Interface: /v5/api/dashboard/share/user/rejection/result?entityId=&userId=
Function: use this interface to obtain all template information shared with me (current login user)
URL: /v5/api/dashboard/share
Request example: localhost:37799/webroot/decision/v5/api/dashboard/share
{ "code": "200", "data": [ { "folder": true, "createBy": "b5f0c2ee-640f-4039-a4d4-918b55354898", "description": null, "id": "e5bc1ae63f944050b43d031c21d01847", "reportId": "e5bc1ae63f944050b43d031c21d01847", "originType": "isShared", "pId": "-2", "text": "Analyze bank data with indicators" } ], "detailErrorMsg": null, "errorCode": null, "errorMsg": null, "message": "success", "success": true}
Role: use this interface to trigger global update. Select global update / check update / configuration update according to the status of the current business package
URL: /v5/api/conf/update/generate
Request example: localhost:37799/webroot/decision/v5/api/conf/update/generate
Return data:
{ "success": true}
Function: update all tables in the business package according to the business package name, or update a single table according to the table escape name. Whether the business package or the single table is updated, the full amount of the business package table or the single table is updated. When the escape name of the table is not added, the business package is updated. After adding, the table is updated.
URL: /v5/api/conf/update/pack/table?info=xx
Request example: localhost:37799/webroot/decision/v5/api/conf/update/pack/table?info={"packageName":"business package"}
Return data (version on and before 2020-01-15):
Return data (version 2020-08-04):
{ "msg":Package absent or has no auth!Update all too often!Success}
Request example: localhost:37799/webroot/decision/v5/api/conf/update/pack/table?info={"packageName":"Business package","tableName":"Product sales table"}
Note: if the fullload parameter is false, it means incremental update; if true, it means full update; if the parameter is not filled in, it defaults to true.
{ "msg":Package absent or has no auth!Table is absent!Table is updating or waiting!Update all too often!Success}
Function: query the update status.
URL: /v5/api/conf/update/instance/Task instanceid
Note: this interface is applicable to jars after 2020-11-03; Example of task instance ID: "b58924f1-5141-44a8-9122-fb635b4cd599".
For jar on and after 2020-11-03, the update interface shown in the following table returns the task instance id:
v5/api/conf/update/generate
{ "planId": "3845d501-b96b-46c7-b8c5-1d133dade15f", "taskName": "Bank_ Organization dimension form table update", "startTime": 1602664101054, "endTime": 1602664101867, "state": 1, //Update status, 1 is finished, 2 is running "triggerType": 1, //Trigger mode: 1 is manual, 2 is automatic and 3 is internal "resultType": 2, //Operation result: 1 is all successful, 2 is partial successful "roleName": "admin", "baseTableExpect": 1, "baseTableFinish": 1, "analysisTableExpect": 1, "analysisTableFinish": 0, "relationExpect": 1, "relationFinish": 0}
Function: to obtain the grouping of all service packages under data preparation
URL: /v5/api/conf/groups
Request example:localhost:37799/webroot/decision/v5/api/conf/groups
{ "code": "200", "data": [ { "editable": true, "id": "__no_group__", "initTime": 1531100612398, "myAnalysisTables": [], "name": "__no_group__", "packs": [ { "createBy": "1", "editable": true, "id": "a5e4bcbd09fd4de497d91839a0da82d6", "name": "Business package", "tableCount": 2, "timeStamp": 1536819164195, "type": 2, "usedSpace": 0.0 } ] }, { "editable": true, "id": "de20c13fdcdd436987289588b232c38c", "initTime": 1531138781428, "myAnalysisTables": [], "name": "Functional data", "packs": [ { "createBy": "1", "editable": true, "id": "18d26ef06d1f4e91adaa12c80feb2daa", "name": "saleDEMO", "tableCount": 9, "timeStamp": 1531101074181, "type": 2, "usedSpace": 4.123135566711426 }, ] }, ], "detailErrorMsg": null, "errorCode": null, "errorMsg": null, "message": "success", "success": true}
Function: during integration, you cannot manually enter the name of the business package or the name of the table one by one to make corresponding updates. You need an interface to obtain these information
URL: v5/api/conf/packs/{packageId}
Request example: localhost:37799/webroot/decision/v5/api/conf/packs/{packageId}
{ "code": "200", "data": { "editable": true, "errorTable": [], "missTable": [], "name": "saleDEMO", "tables": [ { "connectionName": "BI Demo", "createBy": "1", "editable": true, "fields": [ { "enable": true, "engineType": "Direct", "fieldGroupType": 0, "id": "DEMO[5f]PRODUCT_[4ea7][54c1]ID", "name": "productID", "primaryKey": false, "size": 32, "transferName": "productID", "type": 32, "usable": true }, { "enable": true, "engineType": "Direct", "fieldGroupType": 0, "id": "DEMO[5f]PRODUCT_[4ea7][54c1][540d][79f0]", "name": "Product Name:", "primaryKey": false, "size": 32, "transferName": "Product Name:", "type": 16, "usable": true } ], "initTime": 1539161534282, "memorize": true, "name": "DEMO_PRODUCT", "operators": null, "pack": "18d26ef06d1f4e91adaa12c80feb2daa", "realTimeData": false, "selected": 0, "tableName": "DEMO_PRODUCT", "transferName": "Product name dimension", "type": 1, "usedSpace": 0.0007028579711914062 }, ] }, "detailErrorMsg": null, "errorCode": null, "errorMsg": null, "message": "success", "success": true}
Function: Get data preparation interface
URL: /v5/api/conf/page
Request example: localhost:37799/webroot/decision/v5/api/conf/page
Function: when exporting excel from BI components or global export, add some user-defined operations before the export operation, which can be implemented with this interface. Such as custom encryption of exported files;
Interface: ExportHandleProvider
package com.finebi.stable.fun; import com.fr.stable.fun.mark.Mutable; import java.io.OutputStream; /** * Created by Hiram on 2018/11/14. */public interface ExportHandleProvider extends Mutable { String XML_TAG = "ExportHandleProvider"; int CURRENT_LEVEL = 1; /** * * @param originalOutputStream Original export stream * @param type Export type * @return Processed stream */ OutputStream handleStream(OutputStream originalOutputStream, ExportType type);}
Sample source code:
The following example source code simply counts the size of the exported file and outputs it in the log.
Write a CountExportHandle for intercepting and processing,Return a CountOutputStream, Count when write, and output the size when close.
CountExportHandle:
import com.finebi.stable.fun.ExportType;import com.finebi.stable.fun.impl.AbstractExportHandleProvider;import java.io.OutputStream;public class CountExportHandle extends AbstractExportHandleProvider { @Override public OutputStream handleStream(OutputStream originalOutputStream, ExportType type) { return new CountOutputStream(originalOutputStream); } }
CountOutputStream:
import com.fr.log.FineLoggerFactory;import java.io.IOException;import java.io.OutputStream; public class CountOutputStream extends OutputStream { private OutputStream out; private int count; public CountOutputStream(OutputStream out) { this.out = out; } @Override public void write(int b) throws IOException { count++; out.write(b); } @Override public void write(byte[] b) throws IOException { count += b.length; out.write(b); } @Override public void write(byte[] b, int off, int len) throws IOException { count += len; out.write(b, off, len); } @Override public void flush() throws IOException { out.flush(); } @Override public void close() throws IOException { FineLoggerFactory.getLogger().info("===== export length: {} ======", count); out.close(); }}
Note: the use of this interface requires secondary development.
Function: use this interface to log in to the BI system.
URL: /login/cross/domain?fine_username=name&fine_password=password&validity=-1&callback=myfunction
In order to unify the portal, many users often integrate the background management page of FineBI into their own system. This chapter provides the page integration interface supported by FineBI.
Take the integration of the "template management page" of the data decision system into the user system as an example.
Enter the data decision system as an administrator and visit the link:http://localhost:37799/webroot/decision/dashboard/management , as shown in the following figure:
Enter the data decision system as an administrator, and the calling method of each interface is access:http://ip:port/project name/decision/Interface call
The management menu range that supports the integration of individual pages is shown in the following table:
No global settings
Note: jar in version 5.1.5, 2020-09-02 and later supports calling this interface.
Problem description:
After entering the data decision system as a non administrator, the user access: http://IP:Port/webroot/decision/Interface call, the following error occurs:
Solution:
You need to obtain permission for this page. Please refer to Permission.
The service package name and ID value are stored in the fine_conf_entity table of the finedb database. The field ID and field value are described in the following table:
The steps to view the service package ID are as follows:
1) New finedb data connection is added. Please refer to Introduction to FineDB for details.
2) Create a new server dataset. The SQL statement is:
SELECT *FROM fine_conf_entity where ID like 'DirectPackageConfStore.mapHolder%' and ID like '%name'
As shown in the following figure:
3) Preview the newly created SQL data set to view the business package ID. As shown in the following figure:
Because the URL in FineBI passes the JSON object, if some servers do not support the JSON URL, you need to encodeURIComponent() the JSON type URL parameter value first.
For example:
dir={"name":"New dashboard12","catalog":[]} Need to be changed to::encodeURIComponent(JSON.stringify({"name":"New dashboard12","catalog":[]}))
The code is displayed as:
dir=%7B%22name%22%3A%22%E6%96%B0%E5%BB%BA%E4%BB%AA%E8%A1%A8%E6%9D%BF12%22%2C%22catalog%22%3A%5B%5D%7D
During system integration, if there is an error in the background, an error code (errorcode) will be returned. Please refer to Error code summary for specific exception code definitions
Problem description
FineBI embeds the iframe page into other pages and reports an error: xxx拒绝了我们的连接请求, as shown in the following figure:
Solution
When the administrator enters the platform, click "Manage > Security" to close Click Attack Protection button. As shown in the following figure:
售前咨询电话
400-811-8890转1
在线技术支持
在线QQ:800049425
热线电话:400-811-8890转2
总裁办24H投诉
热线电话:173-1278-1526
文 档反 馈
鼠标选中内容,快速反馈问题
鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。
不再提示
10s后关闭