更新业务视图-SQL查询
- 接口调用-方式1
/**
* 更新业务视图-SQL查询示例
*/
public class UpdateBizViewDemo {
public static void main(String[] args) {
String user = "admin"; // 用户名
String password = "admin"; // 密码
String smartbiURL = "http://10.10.31.49:11000/smartbi"; // Smartbi链接
ClientConnector conn = null;
try {
conn = new ClientConnector(smartbiURL); // 创建Smartbi链接对象
// 建立此连接时,就对smartbi进行了登录
conn.open(user, password);
// POST请求的请求体
String body = "{\r\n" + " \"id\": \"I8a8a9fb101963d913d91a67a01963da4c01a0002\",\r\n"
+ " \"alias\": \"SQL查询-更新\",\r\n" + " \"sql\": \" select OrderID from orders\"\r\n" + "}";
JSONObject json = JSONObject.fromString(body);
// 更新业务视图-SQL查询
InvokeResult result = conn.remoteInvoke("AugmentedDataSetForVModule", "updateDataModelBizView",
new Object[] { json });
if (result != null && result.isSucceed()) {
JSONObject object = JSONObject.fromObject(result.getResult());
String id = (String) object.optString("id");
System.out.println("更新的SQL查询的id: " + id);
}
} finally {
if (conn != null) {
conn.close();
}
}
}
}
- 接口调用-方式2(仅支持在已登录的情况下)
http://host:port/smartbi/smartbix/api/dataModel/updateBizView
- 接口请求类型
POST
- 输入
DataModelBizViewUpdatedVO
属性 | 类型 | 说明 |
---|---|---|
id | String | 业务视图的id |
alias | String | 业务视图的别名 |
sql | String | 业务视图的sql, 暂不支持参数 |
- 返回值
CheckResult
属性 | 类型 | 说明 |
---|---|---|
id | Stirng | 业务视图 id |
errorCode | String | 错误码,成功时错误码、错误信息同时为空 |
errorMessage | String | 错误信息,成功时错误码、错误信息同时为空 |
detail | String | 错误详细信息,成功时错误码、错误信息同时为空 |
简单示例
{
"id": "I8a8a9fb101963d913d91a67a01963da4c01a0002",
"alias": "SQL查询-更新",
"sql": " select OrderID from orders"
}