資料表API

概述

版本

FineBI伺服器版本
功能變更
6.0-

功能簡介

本文講解FineBI中資料表相關API。

新增資料集-DB表

API簡介



API作用新增DB表
APIURL

/v5/api/table/add

請求類型POST
注意事項與5.XAPI不同

請求參數-Body參數

參數是否必填參數值
{

    "type":1,

    "connectionName":"BI Demo",

    "tableName":"客戶磁軌表",

    "name":"BIDemo_客戶磁軌表",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

    "comment":""

}

1)type:表類型為1,代表DB表

2)connectionName:資料連結名稱

3)tableName:資料庫中的表名稱

4)name:新增的資料集名稱(建議使用“資料連結_資料庫中的表名”這樣的形式,作為唯一識別符號)

5)parentId:資料集所在資料夾ID

6)initTime:初始化時間

7)engineType:引擎類型(direct:直連資料;spider:抽取資料)

8)comment:備註資訊,選填

回应實體



請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/table/add?fine_auth_token=XXX

注:使用API時需要登入,需要傳遞token參數。

請求Body{

    "type":1,

    "connectionName":"BI Demo",

    "tableName":"客戶磁軌表",

    "name":"BIDemo_客戶磁軌表",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

}

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "name""BIDemo_客戶磁軌表",

        "transferName""BIDemo_客戶磁軌表",

        "success"true

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意

新增資料集-SQL表

API簡介



API作用新增SQL表
APIURL

/v5/api/table/add

請求類型POST
注意事項與5.XAPI不同

請求參數-Body參數

參數是否必填參數值
{

    "type":2,

    "connectionName":"BI Demo",

    "sql":"select * from 客戶磁軌表",

    "name":"客戶磁軌資訊",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

    "comment":""

}

1)type:表類型為2,代表SQL表

2)connectionName:資料連結名稱

3)sql:SQL語句

4)name:表原始名

5)parentId:資料集所在資料夾ID

6)initTime:初始化時間

7)engineType:引擎類型(direct:直連資料;spider:抽取資料)

8)comment:備註資訊,非必填

回应實體




請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/table/add?fine_auth_token=XXX

注:使用API時需要登入,需要傳遞token參數。

請求Body{

    "type":2,

    "connectionName":"BI Demo",

    "sql":"select * from 客戶磁軌表",

    "name":"客戶磁軌資訊",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

}

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "name""客戶磁軌資訊",

        "transferName""客戶磁軌資訊",

        "success"true

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意

編輯儲存資料集-DB表

API簡介



API作用編輯儲存DB表
APIURL

/v5/api/table/update

請求類型POST
注意事項與5.XAPI不同

請求參數-Body參數

參數值是否必填參數值
{

    "type":1,

    "connectionName":"BI Demo",

    "tableName":"客戶磁軌表",

    "name":"26cd79512cc24c6a816c59ffe54b1a29",

    "transferName":"BIDemo_客戶磁軌表",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

    "comment":""

}

1)type:表類型為1,代表DB表

2)connectionName:資料連結名稱

3)tableName:資料庫中的表名稱

4)name:資料集ID

5)transferName:資料集轉義名

6)parentId:資料集所在資料夾ID

7)initTime:初始化時間

8)engineType:引擎類型(direct:直連資料;spider:抽取資料)

9)comment:備註資訊

回应實體



請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/table/update?fine_auth_token=XXX

注:使用API時需要登入,需要傳遞token參數。

請求Body

{

    "type":1,

    "connectionName":"BI Demo",

    "tableName":"客戶磁軌表",

    "name":"26cd79512cc24c6a816c59ffe54b1a29",

    "transferName":"BIDemo_客戶磁軌表",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

}

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "name""BIDemo_客戶磁軌表",

        "transferName""BIDemo_客戶磁軌表",

        "success"true

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意

編輯儲存資料集-SQL表

API簡介



API作用編輯儲存SQL表
APIURL

/v5/api/table/update

請求類型POST
注意事項與5.XAPI不同

請求參數-Body參數

參數是否必填參數值
{

    "type":2,

    "connectionName":"BI Demo",

    "sql":"select * from 客戶磁軌表",

    "name":"26cd79512cc24c6a816c59ffe54b1a29",

    "transferName":"客戶磁軌資訊",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

    "comment":""

}

1)type:表類型為2,代表SQL表

2)connectionName:資料連結名稱

3)sql:SQL語句

4)name:表id

5)transferName:表轉義名

5)parentId:資料集所在資料夾ID

6)initTime:初始化時間

7)engineType:引擎類型(direct:直連資料;spider:抽取資料)

8)comment:備註資訊,非必填

回应實體



請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/table/update?fine_auth_token=XXX

注:使用API時需要登入,需要傳遞token參數。

請求Body{

    "type":2,

    "connectionName":"BI Demo",

    "sql":"select * from 客戶磁軌表",

    "name":"26cd79512cc24c6a816c59ffe54b1a29",

    "transferName":"客戶磁軌資訊",

    "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

    "initTime":0,

    "engineType":"spider"

}

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "name":"26cd79512cc24c6a816c59ffe54b1a29",

        "transferName":"客戶磁軌資訊",

        "success"true

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意

修改資料集轉義名

API簡介



API作用修改資料集轉義名
APIURL

/v5/api/tables/{tableName}/rename

請求類型POST
注意事項tableName是表原始名

請求參數-body參數

body是否必填描述說明

{

"name":"新轉義名",

"moduleType":1

}

1)name:表的新轉義名

2)connectionName:表存放位置,1代表公共資料,2代表我的分析

回应實體



請求連結

表原始名:

BI Demo_教師資訊表

連結:

http://192.168.5.138:37799/webroot/decision/v5/api/tables/BI Demo_教師資訊表/rename?fine_auth_token=xxx

注:使用API時需要登入,需要傳遞token參數。

請求body

{

"name":"教育_2022屆教師資訊表",

"moduleType":1

}

回应成功

{

    "success"true,

    "code""200",

    "message""success",

    "data": [],

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

}

截圖示意

刪除資料集

API簡介



API作用刪除資料集
APIURL

/v5/api/pack/delete

請求類型POST
注意事項與5.XAPI不同

請求參數-body參數

body是否必填描述說明

{"tableNames":["表原始名"]}

tableName為待刪除的表原始名

回应實體



請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/pack/delete?fine_auth_token=xxx

注:使用API時需要登入,需要傳遞token參數。

請求body{

    "tableNames":["BI Demo_錄取資訊表"]

}

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "success": {

            "tableNames": [

                "BI Demo_錄取資訊表"

            ],

            "widgetIds": [],

            "reportIds": [],

            "docIds": [],

            "subjectIds": [],

            "packIds": []

        },

        "fail": {

            "tableNames": [],

            "widgetIds": [],

            "reportIds": [],

            "docIds": [],

            "subjectIds": [],

            "packIds": []

        },

        "errorDetailBeanMap": {}

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意

獲取資料集資訊

API簡介



API作用獲取資料集相關資訊
APIURL

/v5/api/table/{tableName}/get

請求類型GET
注意事項tableName是資料表的原始名

回应實體



請求範例

http://172.17.0.25:37799/webroot/decision/v5/api/table/BI Demo_各省招生人數表/get?fine_auth_token=xxx

注:使用API時需要登入,需要傳遞token參數。

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "name""BI Demo_各省招生人數表",

        "transferName""各省招生人數表",

        "type"2,

        "createBy""1",

        "initTime"0,

        "comment"null,

        "validStatus""VALID",

        "parentId""6fb11e7b1e6e4ff3bcb907a5747527b0",

        "editable"true,

        "sqlEditable"true,

        "publishStatus"0,

        "coopAnalysis"false,

        "creatorAuth"true,

        "connectionName""BI Demo",

        "moduleType"1,

        "extractDataSetting"0,

        "inherit"false,

        "belongAnalysis"false,

        "configUpdateTime"1655283326594,

        "engineType""spider"

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意

回应參數說明

參數
參數值說明
name資料集原始名
transferName資料集轉義名
type

資料集類型

1:DB表

2:SQL表

createBy資料集建立者帳號
initTime初始化時間
comment備註
validStatus標紅資訊
parentID資料集所在資料夾ID
editable

是否可編輯

true:是

false:否

sqlEditable

SQL是否可編輯

true:是

false:否

publicStatus

發佈狀態

0:未發佈

1:已發佈

coopAnalysis

是否協作給當前使用者

true:是

false:否

creatorAuth

是否擁有和建立者相等的權限(我的分析下專用)

true:是

false:否

connectionName資料連結名稱
moduleType

資料集所處位置

1:公共資料

2:我的分析

extractDataSetting

抽取狀態

inherit

是否開啟權限繼承

true:開啟

false:未開啟

belongAnalysis

是否屬於當前使用者的「我的分析」(公共資料下專用)

true:是

false:否

configUpdateTime最近改動時間
engineType資料集引擎類型

direct:直連資料

spider:抽取資料

獲取資料集資料

API簡介



API作用獲取資料集的資料預覽
APIURL

/v5/api/tables/fields/page

請求類型POST

請求參數-body參數

body是否必填描述說明

{

"tableName":"表原始名",

"pageIndex":"頁碼",

"limit":"資料量限制",

"pageSize":"分頁大小"

}

1)tableName為表原始名

2)pageIndex為頁碼

3)limit為資料量限制

可不填,不填預設為5000

最大不可超過資料存取量

4)pageSize為分頁大小

可不填,不填預設為100

回应實體



請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/tables/fields/page?fine_auth_token=xxx

注:使用API時需要登入,需要傳遞token參數。

請求body

{

"tableName":"BI Demo_畢業生資訊表",

"pageIndex":"1"

}

回应成功{

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "performBean": {

            "info": {

                "startTime"1669105706067,

                "endTime"1669105706082,

                "user""1",

                "category""BI Demo_畢業生資訊表",

                "subCategory""preview",

                "queryId""6b5aea688a1a4f289e6d449d039c21ba",

                "componentType"8,

                "timezone""Asia/Shanghai",

                "start"0,

                "renderStart"0,

                "consumePerformance"0,

                "frontBackPerformance"0

            },

            "tceridInfo": {

                "rulesCacheInfo""false",

                "finalCacheInfo""false"

            },

            "cacheHitInfo": {

                "cacheType"-1,

                "cacheCostTime"0,

                "rowSize"-1

            },

            "summary": {

                "prepare"0,

                "sqlExecute"6,

                "dbDataTransfer"0,

                "cacheCalculator"0

            },

            "details": {

                "data": [

                    [

                        "BI-Basic_Performance_Sql_Generator_Optimize",

                        null,

                        0,

                        "\n*************** Get a baseCriteria(id:1363288290) begin ***************\nselect:         畢業生類型, 學科類型, 學位類型\nwhere:          \ngroup:          \norder:          \nlimit:          5000, offset : 0\ncustom group:   \nfrom:           [SpiderLimitEntity]T_D9E899\n*************** Get a baseCriteria end ********************************",

                        null,

                        null,

                        null,

                        1669105706072,

                        1669105706072,

                        null

                    ],

                    [

                        "BI-Basic_Performance_Sql_Execute",

                        null,

                        6,

                        null,

                        null,

                        null,

                        4,

                        1669105706072,

                        1669105706078,

                        null

                    ]

                ]

            }

        },

        "needShowTotalRowSize"true,

        "parentCached"false,

        "fields": [

            {

                "id""BI Demo[5f]畢業生資訊表_[6bd5][4e1a][751f][7c7b][578b]",

                "name""畢業生類型",

                "type"16,

                "size"0,

                "enable"true,

                "usable"true,

                "transferName""畢業生類型",

                "fieldGroupType"0

            },

            {

                "id""BI Demo[5f]畢業生資訊表_[5b66][79d1][7c7b][578b]",

                "name""學科類型",

                "type"16,

                "size"0,

                "enable"true,

                "usable"true,

                "transferName""學科類型",

                "fieldGroupType"0

            },

            {

                "id""BI Demo[5f]畢業生資訊表_[5b66][4f4d][7c7b][578b]",

                "name""學位類型",

                "type"16,

                "size"0,

                "enable"true,

                "usable"true,

                "transferName""學位類型",

                "fieldGroupType"0

            }

        ],

        "data": [

            [

                "留學生",

                "管理學",

                "理論型博士"

            ],

            [

                "普通在讀生",

                "法學",

                "博士生"

            ],

            [

                "交換生",

                "文學",

                "理論型博士"

            ],

            [

                "普通在讀生",

                "經濟學",

                "理論型博士"

            ]

        ],

        "fieldsLabel": [],

        "pageInfo": {

            "totalRows"688,

            "pageSize"100,

            "pageIndex"1

        },

        "dataStatus": {

            "tableName""BI Demo_畢業生資訊表",

            "updateStatus"0,

            "errorCode"0,

            "limit"0.0

        },

        "updateStatus": {

            "table": {

                "name""BI Demo_畢業生資訊表",

                "transferName""教育_畢業生資訊表",

                "type"2

            },

            "diffConf"false,

            "hasdata"true,

            "currentType"4,

            "startTime"0,

            "endTime"1662375106784,

            "process"0.0,

            "dataType"0,

            "hasUpdated"true

        }

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

}

截圖示意

獲取資料集分頁資料

API簡介



API作用獲取資料集的資料預覽, 限制資料量不超過10w,支援設定每一頁資料量
APIURL

/v5/api/tables/data/page

請求類型POST

請求參數-body參數

body是否必填描述說明

{

"tableName":"表原始名",

"pageIndex":"頁碼",

"pageSize":"每頁資料量"

}

1)tableName為表原始名

2)pageIndex為頁碼

3)pageSize為每頁的資料條數

回应實體



請求連結

http://172.17.0.25:37799/webroot/decision/v5/api/tables/data/page?fine_auth_token=xxx

注:使用API時需要登入,需要傳遞token參數。

請求body

{

"tableName":"BI Demo_畢業生資訊表",

"pageIndex":"1",

"pageSize":"2"

}

回应成功{

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "needShowTotalRowSize"true,

        "parentCached"false,

        "fields": [

            {

                "id""BI Demo[5f]畢業生資訊表_[6bd5][4e1a][751f][7c7b][578b]",

                "name""畢業生類型",

                "type"16,

                "size"32,

                "enable"true,

                "usable"true,

                "transferName""畢業生類型",

                "fieldGroupType"0

            },

            {

                "id""BI Demo[5f]畢業生資訊表_[5b66][79d1][7c7b][578b]",

                "name""學科類型",

                "type"16,

                "size"32,

                "enable"true,

                "usable"true,

                "transferName""學科類型",

                "fieldGroupType"0

            },

            {

                "id""BI Demo[5f]畢業生資訊表_[5b66][4f4d][7c7b][578b]",

                "name""學位類型",

                "type"16,

                "size"32,

                "enable"true,

                "usable"true,

                "transferName""學位類型",

                "fieldGroupType"0

            }

        ],

        "data": [

            [

                "留學生",

                "管理學",

                "理論型博士"

            ],

            [

                "普通在讀生",

                "法學",

                "博士生"

            ]

        ],

        "fieldsLabel": [],

        "pageInfo": {

            "totalRows"688,

            "pageSize"2,

            "pageIndex"1

        },

        "dataStatus": {

            "tableName""BI Demo_畢業生資訊表",

            "updateStatus"0,

            "errorCode"0,

            "limit"0.0

        },

        "updateStatus": {

            "table": {

                "name""BI Demo_畢業生資訊表",

                "transferName""教育_畢業生資訊表",

                "type"1

            },

            "diffConf"false,

            "hasdata"true,

            "currentType"4,

            "startTime"0,

            "endTime"1658727981210,

            "process"0.0,

            "monitorExist"false

        }

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

}

截圖示意

獲取我的分析下資料的查詢SQL

API簡介



API作用獲取我的分析中,呼叫了直連資料的資料表的查詢SQL
APIURL

/v5/api/analysis/table/execute/sql/{tableName}

請求類型GET
注意事項tableName為表ID

回应實體



請求範例

http://172.17.0.25:37799/webroot/decision/v5/api/analysis/table/execute/sql/a9ae120c0a85448fa4ad4fb5d1762a4d?fine_auth_token=XXX

注:使用API時需要登入,需要傳遞token參數。

回应成功

callback({

    "success"true,

    "code""200",

    "message""success",

    "data": {

        "sql""\nselect \n  t0.\"__fcol_0\" \"地區\", \n  t0.\"__fcol_1\" \"銷售員\", \n  t0.\"__fcol_2\" \"產品類型\", \n  t0.\"__fcol_3\" \"產品\", \n  t0.\"__fcol_4\" \"銷量\"\nfrom (\n  select \n    T_53DAD1AFB3D343F9A4140.\"地區\" \"__fcol_0\", \n    T_53DAD1AFB3D343F9A4140.\"銷售員\" \"__fcol_1\", \n    T_53DAD1AFB3D343F9A4140.\"產品類型\" \"__fcol_2\", \n    T_53DAD1AFB3D343F9A4140.\"產品\" \"__fcol_3\", \n    T_53DAD1AFB3D343F9A4140.\"銷量\" \"__fcol_4\"\n  from (SELECT *from 銷量\n) T_53DAD1AFB3D343F9A4140\n) t0"

    },

    "errorCode"null,

    "detailErrorMsg"null,

    "errorMsg"null

})

截圖示意


附件列表


主题: 部署整合
已经是第一篇
已经是最后一篇
  • 有帮助
  • 没帮助
  • 只是浏览
中文(繁體)

滑鼠選中內容,快速回饋問題

滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

不再提示

9s后關閉

獲取幫助
線上支援
獲取專業技術支援,快速幫助您解決問題
工作日9:00-12:00,13:30-17:30在线
頁面反饋
針對當前網頁的建議、問題反饋
售前咨詢
業務咨詢
電話:0933-790886或 0989-092892
郵箱:taiwan@fanruan.com
頁面反饋
*問題分類
不能為空
問題描述
0/1000
不能為空

反馈已提交

网络繁忙