Skip to content

应用

应用说明

应用针对某一场景创建,它由多个仪表盘组成。 应用包含了用户一次探索所需要的全部数据、图表以及关系模型,非常适合作为日常工作的一个封装概念。

应用的定义

应用结构说明

字段类型描述
idLONG应用的 id
titleSTRING应用的标题
optionsOBJECT应用的配置信息
options.dashboardsNUMBER 数组此应用下的仪表盘 id 列表
options.chartsNUMBER 数组此应用下的图表 id 列表
options.datasetsNUMBER 数组此应用下的数据集 id 列表
options.dashboardsOrderNUMBER 数组此应用下的仪表盘的显示顺序
options.enableAppRuleBOOL是否启用行权限控制
options.publishConfigOBJECT此应用的发布设置,只在发布的应用中启用
options.publishConfig.publishTitleSTRING发布的应用标题
options.publishConfig.publisherSTRING发布的用户名
options.publishConfig.coverImageIdNUMBER发布的应用的封面图片 id
options.publishConfig.watermarkImageIdNUMBER发布的应用的水印图片 id
options.publishConfig.duplicatedPermittedBOOL发布的应用是否允许复制数据集
options.publishConfig.showDetailPermittedBOOL只读模式下访问应用是否允许显示详情
options.publishConfig.downloadPermittedBOOL只读模式下访问应用是否允许下载数据
options.publishConfig.zoomInPermittedBOOL只读模式下访问应用是否下钻
options.publishConfig.targetFolderIdLONG发布的目录 id
options.publishConfig.descriptionSTRING发布应用描述
options.publishConfig.foldersTitleSTRING 数组发布的目录路径名称
options.publishConfig.publisherDisplayConfigOBJECT此应用的发布者显示配置
options.publishConfig.publisherDisplayConfig.idLONG发布者 id
options.publishConfig.publisherDisplayConfig.typeSTRING发布者类型
options.publishConfig.publisherDisplayConfig.nameSTRING发布者名称
options.appTemplateUUIDSTRING应用模版的 uuid,只在导入、导出模版用到,不存库
options.filtersOBJECT数组全局过滤器列表
isPublishBOOL应用是不是发布区的应用
publishHashSTRING应用发布的哈希值
publishedByNUMBER发布区应用的源应用 id
folderIdLONG应用所在的文件夹 id
areaSTRING应用所在的区域,可选值参照area值说明
shareHashSTRING分享应用的哈希值
dataModeSTRING应用的数据权限,可选值参照dataMode 值说明
entityGroupSTRING邮件自动推送的执行计划类别,用于管理执行计划,固定为APP_EMAIL
entityKeySTRING邮件自动推送的执行计划关键字,用于管理执行计划
execDetailOBJECT创建邮件推送执行计划需要用到的任务描述信息,详见执行计划
refreshEntityGroupSTRING应用数据集刷新的执行计划类别,用于管理执行计划,固定为APP_REFRESH
refreshExecDetailOBJECT创建数据集刷新执行计划需要用到的任务描述信息,详见执行计划
hsVersionINTEGER可选,本次编辑的版本号,从0开始,修改前先GET待修改资源获取当前版本号,修改时带上刚刚获取的版本号,服务端会检查并发冲突。不带版本号不检查并发冲突。
tenantIdLONG可选, 租户id
typeSTRING应用类型, 可选值参照appType值说明
defaultDatasetLONG可选,应用中用于做图的默认数据集
publishStateBOOL创作区的应用是否发布
latestAuthorizedByLONG应用最近一次的授权者
latestAuthorizedAtDATE应用最近一次授权时间
latestPublishedByLONG应用最近一次的发布者
latestPublishedAtDATE应用最近一次发布时间
area 值说明
字段值描述
PERSONAL_AREA应用创作区的个人区
PUBLIC_AREA应用创作区的共享区
DATA_MART数据集市
APP_MART应用集市
dataMode 值说明
字段值描述
APP_MODE应用作者
DATASET_MODE数据集作者
VIEWER_MODE使用者
appType 值说明
字段值描述
ANALYTIC_APP常用应用,用于分析场景
QUERY_APP查询应用,用于自助查询场景
DATA_APP数据包,用于数据集市区处理数据集
REPORT_APP报表应用

接口说明

创建应用

请求URL

http
POST /api/apps HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

request body 请求体

应用结构说明

字段类型描述
titleSTRING应用的标题
folderIdLONG应用所在的文件夹 id, 应用创作共享空间的根目录 id 为 1, 数据集市的根目录 id 为 2
areaSTRING应用所在区域,需与folderId对应的目录所在区域一致,默认为PERSONAL_AREA

返回对象的格式说明

应用结构说明

接口示例1 在应用创作区新建应用

http
POST /api/apps HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "title": "应用名称",
  "options": {
    "dashboardsOrder": [],
    "themes": {}
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 46176,
    "title": "应用名称",
    "options": {
      "dashboardsOrder": []
    },
    "createdBy": 6,
    "createdAt": "2020-06-03 17:30:27",
    "updatedBy": 6,
    "updatedAt": "2020-06-03 17:30:27",
    "area": "PERSONAL_AREA",
    "dataMode": "APP_MODE",
    "publish": false,
    "type": "ANALYTIC_APP"
  }
}

接口示例2 在应用创作共享空间根目录下创建应用

http
POST /api/apps HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "folderId": 1,
  "title": "应用名称",
  "area": "PULIC_AREA",
  "options": {
    "dashboardsOrder": [],
    "themes": {}
  }
}

接口示例3 在应用集市团队空间根目录下创建应用

http
POST /api/apps HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "folderId": 2,
  "title": "应用名称",
  "area": "SYSTEM_PORTAL",
  "options": {
    "dashboardsOrder": [],
    "themes": {}
  }
}

接口示例4 在应用创作下创建自助查询应用

http
POST /api/apps HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "title": "应用名称",
  "options": {
    "dashboardsOrder": [],
    "themes": {}
  },
  "type": "QUERY_APP"
}

查询应用

查询用户能看到的应用列表,在应用集市和应用创作区使用。

请求URL

http
GET /api/apps HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
publishBOOLEAN获取应用集市区应用时设置为 true,获取应用协作区应用时设置为 false
orderByString排序字段
pOrCByCurrentBOOLEAN应用集市区,查询 "我发布的" 应用时设置为 true, "发布给我的" 应用时设置为 false;应用协作区,查询"我协作的" 应用时设置为 true, "协作给我的" 应用时设置为 false
createdByCurrentBOOLEAN查询 "我创建的" 应用时设置为 true,"协作给我的" 应用时设置为false,用于应用创作区
showHideBOOLEAN是否显示隐藏的应用,用于应用集市区
queryAllBOOLEAN是否显示全部应用
idsString要查询的应用id列表,用逗号隔开如:1,2,3,4

返回对象的格式说明

应用结构说明

接口示例1

http
GET /api/apps?pOrCByCurrent=false&offset=0&limit=20&orderBy=updatedAt&orderType=desc HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 45806,
      "title": "口罩专题分析",
      "cover": "",
      "options": {
        "dashboards": [
          1,
          2,
          3,
          5
        ],
        "datasets": [
          1
        ],
        "dashboardsOrder": [
          1,
          2,
          3,
          5
        ],
        "appTemplateUUID": "c05b0590-4685-4d3e-ac32-6cace767360f"
      },
      "createdBy": 187,
      "createdAt": "2020-05-09 10:48:59",
      "updatedBy": 187,
      "updatedAt": "2020-05-09 10:48:59",
      "visible": true,
      "hsVersion": 0,
      "area": "PERSONAL_AREA",
      "dataMode": "APP_MODE",
      "accessCount": 6,
      "creator": {
        "id": 187,
        "name": "anonymous",
        "email": "anonymous@hengshi.com"
      },
      "updater": {
        "id": 187,
        "name": "anonymous",
        "email": "anonymous@hengshi.com"
      },
      "collaborated": false,
      "datasets": [
        1
      ]
    },
    {
      "id": 45648,
      "title": "jlscreenshot",
      "cover": "",
      "options": {
        "dashboards": [
          1,
          3,
          2
        ],
        "datasets": [
          3,
          2,
          1
        ],
        "dashboardsOrder": [
          1,
          2,
          3
        ],
        "enableAppRule": false
      },
      "createdBy": 187,
      "createdAt": "2020-04-15 16:16:19",
      "updatedBy": 187,
      "updatedAt": "2020-04-24 14:15:44",
      "visible": true,
      "hsVersion": 4,
      "area": "PERSONAL_AREA",
      "dataMode": "APP_MODE",
      "accessCount": 33,
      "publishState": true,
      "type": "ANALYTIC_APP",
      "creator": {
        "id": 187,
        "name": "anonymous",
        "email": "anonymous@hengshi.com"
      },
      "updater": {
        "id": 187,
        "name": "anonymous",
        "email": "anonymous@hengshi.com"
      },
      "collaborated": false,
      "datasets": [
        3,
        2,
        1
      ]
    }
  ],
  "totalHits": 9,
  "offset": 0
}

根据ID查询应用

请求URL

http
GET /api/apps/{appId} HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
appIdINTEGER指定应用的 id
checkStatusBOOLEAN是否检查发布态应用的状态,若为true且发布态应用处于暂停服务状态,则报错

返回对象的格式说明

应用结构说明

接口示例1 查询 id 为 1 的应用

http
GET /api/apps/1 HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 46176,
    "title": "lala",
    "cover": "",
    "options": {
      "dashboards": [
        1
      ],
      "datasets": [
        1
      ],
      "dashboardsOrder": [
        1
      ],
      "enableAppRule": false
    },
    "createdBy": 6,
    "createdAt": "2020-06-03 17:30:27",
    "updatedBy": 6,
    "updatedAt": "2020-06-03 17:36:38",
    "visible": true,
    "isDelete": false,
    "isPublish": false,
    "hsVersion": 1,
    "area": "PERSONAL_AREA",
    "dataMode": "APP_MODE",
    "publishState": false,
    "type": "ANALYTIC_APP",
    "creator": {
      "id": 6,
      "name": "***",
      "email": "***",
      "mobile": "***"
    },
    "action": "admin|read|write",
    "datasets": [
      1
    ],
    "publish": false
  }
}

更新应用

请求URL

http
PUT /api/apps/{appId} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
appIdINTEGER指定应用的 id
request body 请求体

应用结构说明, 可以被修改的内容见下表:

字段类型描述
titleSTRING应用的标题
options.enableAppRuleBOOL是否启用行权限控制
options.publishConfig.showDetailPermittedBOOL只读模式下访问应用是否允许显示详情
options.publishConfig.downloadPermittedBOOL只读模式下访问应用是否允许下载数据
options.publishConfig.zoomInPermittedBOOL只读模式下访问应用是否下钻
dataModeSTRING应用的数据权限,可选值参照dataMode 值说明
folderIdLONG应用目录id,若与当前不一致,则视为移动应用操作,会检查是否可移动与权限

返回对象的格式说明

应用结构说明

接口示例1 更新 id 为 1 的应用标题

http
PUT /api/apps/1 HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "title": "wewe",
  "hsVersion": 1
}

接口示例2 启用 id 为 1 的应用行权限规则

http
PUT /api/apps/1 HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "dataMode": "APP_MODE",
  "options": {
    "dashboards": [
      1,
      2
    ],
    "datasets": [
      7
    ],
    "dashboardsOrder": [
      1,
      2
    ],
    "enableAppRule": true,
    "publishConfig": {
      "zoomInPermitted": true,
      "showDetailPermitted": true,
      "downloadPermitted": true,
      "totalPages": {},
      "duplicatedPermitted": false
    }
  },
  "hsVersion": 1
}

删除应用

请求URL

http
DELETE /api/apps/{appId} HTTP/1.1

请求参数

URL 参数
字段类型是否必须说明
appIdINTEGER指定应用的 id

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
msgSTRING成功返回 success

运行图表获取数据

根据图表配置信息获取图表数据。

请求URL

http
POST /api/apps/{appId}/chart-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型说明
appIdNUMBER必填
Request Body 参数

图表的配置信息,详见图表结构说明

返回对象的格式说明

数据集数据 datasetResultDto

接口示例1

以下是一个按{region_name}做分组,用sum({region_id})做度量的一个数据请求。[Request]中的GROUP函数可以省略,如果是同一个数据集那么dataset: 3这个描述可以省略。纯数据查询这样的请求可以发送为[Request1][Request2]这样的简化形式:

http
POST /api/apps/1/chart-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
   "datasetId": 3,
    "options": {
      "axes": [
         {
            "op": "group",
            "uid": "u_edbee8adba68e26a_0",
            "kind": "function",
            "args": [
               {
                  "kind": "field",
                  "op": "region_name",
                  "dataset": 3
               }
            ]
         },
         {
            "op": "sum",
            "uid": "u_9f886f9cb7bdf1d2_1",
            "kind": "function",
            "args": [
                {
                  "kind": "field",
                  "op": "region_id",
                  "dataset": 3
                }
            ]
        }
      ]
    }
}
http
POST /api/apps/1/chart-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
   "datasetId": 3,
   "options": {
      "axes": [
         {
            "kind": "field",
            "op": "region_name",
         },
         {
            "op": "sum",
            "kind": "function",
            "args": [
               {
                  "kind": "field",
                  "op": "region_id"
               }
            ]
      }
    ]
  }
}
http
POST /api/apps/1/chart-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
   "datasetId": 3,
   "options": {
      "axes": [
         {
            "kind": "formula",
            "op": "{region_name}",
         },
         {
            "kind": "formula",
            "op": "sum({region_id})"

      }
    ]
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "data": {
    "data": [
      [
        "Americas",
        2
      ],
      [
        "Middle East and Africa",
        4
      ],
      [
        "Asia",
        3
      ],
      [
        "Europe",
        1
      ]
    ],
    "schema": [
      {
        "fieldName": "u_edbee8adba68e26a_0"
      },
      {
        "fieldName": "u_9f886f9cb7bdf1d2_1"
      }
    ]
  }
}

运行图表获取原始数据

根据图表配置信息获取图表用到的数据集的原始数据。

请求URL

http
POST /api/apps/{appId}/chart-related-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型说明
appIdNUMBER必填
Request Body 参数

图表的配置信息,详见图表结构说明

返回对象的格式说明

数据集数据 datasetResultDto

接口示例1

http
POST /api/apps/1/chart-related-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
   "datasetId": 3,
   "options": {
      "axes": [
         {
            "op": "group",
            "uid": "u_edbee8adba68e26a_0",
            "kind": "function",
            "args": [
               {
                  "kind": "field",
                  "op": "region_name",
                  "dataset": 3
          }
        ]
      },
      {
        "op": "sum",
        "uid": "u_9f886f9cb7bdf1d2_1",
        "kind": "function",
        "args": [
          {
            "kind": "field",
            "op": "region_id",
            "dataset": 3
          }
        ]
      }
    ],
    "fieldsPolicy": "AXES_ALL"
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "data": [
    {
      "data": [
        [
          1,
          "Europe"
        ],
        [
          2,
          "Americas"
        ],
        [
          3,
          "Asia"
        ],
        [
          4,
          "Middle East and Africa"
        ]
      ],
      "schema": [
        {
          "fieldName": "region_id",
          "type": "number",
          "label": "region_id"
        },
        {
          "fieldName": "region_name",
          "type": "string",
          "label": "region_name"
        }
      ],
      "layer": "a_ivt_regions"
    }
  ]
}

分页查询回收站中的应用

查询不同区域下回收站中的应用

请求URL

http
GET /api/list-trash HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型说明
area枚举可选,有效值参照area值说明,默认是 PERSONAL_AREA
orderBySTRING可选,排序字段,默认是按照更新时间降序排序
orderTypeSTRING可选,排序类型,asc - 表示升序,desc - 表示降序
limitNUMBER可选,单页限制条数,默认是10
offsetNUMBER可选,页数偏移量,默认是0

返回对象的格式说明

app对象的数组。

接口示例1

http
GET /api/list-trash?area=PERSONAL_AREA HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "offset": 0,
    "totalHits": 127,
    "data": [
      {
        "id": 327,
        "title": "新建应用2 (9)",
        "cover": "",
        "options": {
          "dashboardsOrder": [
            1,
            2
          ]
        },
        "createdBy": 1,
        "createdAt": "2019-08-20 16:20:56",
        "updatedBy": 1,
        "updatedAt": "2019-12-17 17:47:30",
        "visible": true,
        "isDelete": true,
        "hsVersion": 4,
        "area": "PERSONAL_AREA",
        "publish": false,
        "publicPublish": false
      }
    ]
  }
}

恢复回收站中的应用

恢复回收站中的应用

请求URL

http
POST /api/apps/{appId}/restore HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型说明
appIdINTEGER指定要恢复的应用 id

接口示例1

http
POST /api/apps/1664/restore HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": 1
}

彻底删除回收站中的应用

彻底删除回收站中的应用

请求URL

http
POST /api/apps/{appId}/prune HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型说明
appIdINTEGER指定要恢复的应用 id

接口示例1

http
POST /api/apps/1664/prune HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": 1
}

在当前app下用HE 查询数据

在当前app下用 HE 语句查询数据

请求URL

http
POST /api/apps/{appId}/query HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
URL 请求参数

| appId | NUMBER | 必填,应用的 id | | limit | NUMBER | 可选,返回记录的最大条数,默认是1000 | | offset | NUMBER | 可选,返回第几页数据,默认是0 |

Request Body 参数

HE 表达式,详情参照HE 的数据集函数

返回对象的格式说明

数据集数据 datasetResultDto

参考示例

http
POST /api/apps/1/query HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "kind": "formula",
  "op": "summarize(dataset(1), {type}, sum({votes}) as 'sum1')"
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "data": [
      [
        "喜剧",
        16.5
      ],
      [
        "动画",
        16.6
      ]
    ],
    "schema": [
      {
        "fieldName": "type",
        "visible": true,
        "nativeType": "text"
      },
      {
        "fieldName": "sum1",
        "visible": true,
        "nativeType": "numeric"
      }
    ]
  }
}

批量隐藏 & 排序仪表盘

批量隐藏 & 排序仪表盘

请求URL

http
PUT /api/apps/{appId}/update-dashbords-order-hide HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

Request Body 参数
json
{
  "options": {
    "dashboardsOrder": [
      1,
      2,
      3
    ]
  },
  "resourceBatchUpdateDtos": [
    {
      "ids": [
        1
      ],
      "pathAndValues": [
        {
          "path": [
            "hide"
          ],
          "value": false
        }
      ]
    },
    {
      "ids": [
        2,
        3
      ],
      "pathAndValues": [
        {
          "path": [
            "hide"
          ],
          "value": true
        }
      ]
    }
  ]
}

接口示例1

http
PUT /api/apps/{appId}/update-dashbords-order-hide HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "options": {
    "dashboardsOrder": [
      1,
      2,
      3
    ]
  },
  "resourceBatchUpdateDtos": [
    {
      "ids": [
        1
      ],
      "pathAndValues": [
        {
          "path": [
            "hide"
          ],
          "value": false
        }
      ]
    },
    {
      "ids": [
        2,
        3
      ],
      "pathAndValues": [
        {
          "path": [
            "hide"
          ],
          "value": true
        }
      ]
    }
  ],
  "hsVersion": 5
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 45821,
    "title": "hideDashbaord",
    "cover": "",
    "options": {
      "dashboardsOrder": [
        1,
        2,
        3
      ],
      "enableAppRule": false
    },
    "createdBy": 8,
    "createdAt": "2020-05-13 14:16:58",
    "updatedBy": 8,
    "updatedAt": "2020-05-13 14:39:14",
    "visible": true,
    "isDelete": false,
    "hsVersion": 6,
    "area": "PERSONAL_AREA",
    "dataMode": "APP_MODE",
    "publish": false
  }
}

上传封面

请求URL

http
PUT /api/apps/{appId}/cover HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

Request Body 参数

表单数据

后端API请求代码样例
java
@Test
public void uploadTest()throws Exception{
        SimpleClientHttpRequestFactory simpleClientHttpRequestFactory=new SimpleClientHttpRequestFactory();
        simpleClientHttpRequestFactory.setConnectTimeout(15000);
        simpleClientHttpRequestFactory.setReadTimeout(5000);
        RestTemplate restTemplate=new RestTemplate(simpleClientHttpRequestFactory);
        HttpHeaders headers=new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        headers.set("Cookie","csrf=142b7fd3-2cbf-4caa-ace5-480ad9871623; sid=3aadc6f7-67ea-49d7-8ec1-de4bb7ef673b");
        headers.set("X-CSRF-Token","142b7fd3-2cbf-4caa-ace5-480ad9871623");
        String url="/api/apps/47/cover";
        FileSystemResource fileSystemResource=new FileSystemResource("/Users/hengshi/Documents/a.jpg");
        MultiValueMap<String, Object> form=new LinkedMultiValueMap<>();
        form.add("file",fileSystemResource);
        form.add("filename","a.jpg");
        HttpEntity<MultiValueMap<String, Object>>files=new HttpEntity<>(form,headers);
        String s=restTemplate.postForObject(url,files,String.class);
        }

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataINTEGER图片的 id

上传水印

请求URL

http
PUT /api/apps/{appId}/watermark HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

Request Body 参数

表单数据

后端API请求代码样例

后端API请求代码样例

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataINTEGER图片的 id

发布应用

请求URL

http
POST /api/apps/{appId}/publish HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体

应用结构说明,只涉及到 options.publishConfig 实体

返回对象的格式说明

应用结构说明

接口示例1 在应用创作区新建应用

http
POST /api/apps/1/publish HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "targetFolderId": 2805,
  "targetArea": "SYSTEM_PORTAL",
  "options": {
    "publishConfig": {
      "publishTitle": "0529-3.1-app",
      "publisher": "trial",
      "coverImageId": 102,
      "watermarkImageId": 103,
      "zoomInPermitted": true,
      "showDetailPermitted": true,
      "downloadPermitted": true,
      "duplicatedPermitted": true,
      "targetFolderId": 1,
      "description": "app description",
      "foldersTitle": [
        "公共空间",
        "文件夹"
      ],
      "publisherDisplayConfig": {
        "id": 123,
        "type": "user",
        "name": "trial"
      }
    }
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 43421,
    "title": "publish app",
    "options": {
      "dashboards": [
        1
      ],
      "datasets": [
      ],
      "dashboardsOrder": [
        1
      ],
      "publishConfig": {
        "zoomInPermitted": false,
        "showDetailPermitted": true,
        "downloadPermitted": true,
        "publishTitle": "publish app",
        "publisher": "trial",
        "totalPages": {
        },
        "duplicatedPermitted": true,
        "publisherDisplayConfig": {
          "id": 1337,
          "type": "user",
          "name": "trial"
        },
        "targetFolderId": 263,
        "foldersTitle": [
          "公共空间",
          "文件夹"
        ],
        "displayPublisher": true
      },
      "enableAppRule": false,
      "enableRuleStrictValidate": false,
      "pagination": {
        "applyToDashboards": [
          1,
          1
        ]
      },
      "source": "PERSONAL_AREA",
      "devices": {
        "pc": true,
        "mobile": false
      },
      "resultCacheInterval": 3600
    },
    "createdBy": 1337,
    "createdAt": "2022-12-29 15:30:58",
    "updatedBy": 1337,
    "updatedAt": "2022-12-29 15:30:58",
    "isDelete": false,
    "isPublish": true,
    "publishHash": "EB086EF1566A844FFF077D40742C9821B",
    "publishedBy": 41589,
    "datasets": [
    ],
    "refreshEntityGroup": "APP_REFRESH",
    "entityKey": "43421",
    "entityGroup": "APP_EMAIL"
  }
}

取消发布

取消发布

请求URL

http
DELETE /api/apps/{appId}/publish/cancel HTTP/1.1

请求参数

request body 参数

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值

说明

该操作只能由应用的创建者执行

接口示例1: 取消发布

http
DELETE /api/apps/{appId}/publish/cancel HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success"
}

查看应用中使用的数据连接

请求URL

http
GET /api/apps/{appId}/connection-replace HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id

返回对象的格式说明

返回对象是dataset list,每个dataset里带有connection的信息。

字段类型描述
idNUMBER数据集的 id
options.connectionIdNUMBER数据连接的 id
options.connectionTitleNUMBER数据连接的标题
options.originSTRING数据连接的类型

接口示例1 列出应用 1 中图表所用到的所有数据连接

http
GET /api/apps/1/connection-replace HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 1,
      "options": {
        "connectionTitle": "testuserattr",
        "connectionId": 4197,
        "origin": "postgresql"
      }
    }
  ]
}

替换应用中使用的数据连接

请求URL

http
POST /api/apps/{appId}/connection-replace HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体

现在使用的数据连接 id 和要替换的数据连接 id 对应关系的列表。例如:[{"current":4197,"replace":4122}]

返回对象的格式说明

字段类型描述
msgSTRING执行成功返回 success

接口示例1 替换应用 1 中图表所用到的一个数据连接

http
POST /api/apps/1/connection-replace HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
[
  {
    "current": 4197,
    "replace": 4122
  }
]
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success"
}

查看应用中使用的数据包

请求URL

http
GET /api/apps/{appId}/dataapp-replace HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id

返回对象的格式说明

字段类型描述
idNUMBER应用的 id
titleSTRING应用的标题
areaSTRING应用所在的区域,可选值参照area值说明
parentsOBJECT 数组应用所在的文件夹列表,顺序是从外层目录到里层目录
parents.[].idNUMBER文件夹的id
parents.[].titleSTRING文件夹的标题
parents.[].areaSTRING文件夹所在的区域

接口示例1 列出应用 1 中图表所用到的所有数据包

http
GET /api/apps/1/dataapp-replace HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 3376,
      "title": "新建数据包 (2)",
      "area": "DATA_MART",
      "parents": [
        {
          "id": 2,
          "title": "data_mart_root_folder",
          "options": {
            "rootType": "PUBLIC_ROOT_FOLDER"
          },
          "isDelete": false,
          "area": "DATA_MART"
        }
      ]
    },
    {
      "id": 3378,
      "title": "数据包过滤 (2)",
      "area": "PERSONAL_AREA"
    }
  ]
}

替换应用中使用的数据包

请求URL

http
POST /api/apps/{appId}/dataapp-replace HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体

现在使用的数据包 id 和要替换的数据包 id 对应关系的列表。例如:[{"current":3376,"replace":154}]

返回对象的格式说明

字段类型描述
msgSTRING执行成功返回 success

接口示例1 替换应用 1 中图表所用到的一个数据包

http
POST /api/apps/1/dataapp-replace HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
[
  {
    "current": 3376,
    "replace": 154
  }
]
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success"
}

全部禁用应用中的单个数据集更新计划

请求URL

http
POST /api/apps/{appId}/disable-all-dataset-schedule HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体
字段类型描述

返回对象的格式说明

字段类型描述
msgSTRING执行成功返回 success

接口示例1 禁用app id为1的所有单个数据集更新计划

http
POST /api/apps/1/disable-all-dataset-schedule HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success"
}

应用刷新时排除这个数据集

请求URL

http
POST /api/apps/{appId}/exclude-in-app-refresh HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体
字段类型描述
entityKeySTRING被排除的数据集的执行计划的entityKey,不包含这个字段,表示全部

返回对象的格式说明

字段类型描述
msgSTRING执行成功返回 success

接口示例1 禁用app id为1的所有单个数据集更新计划

http
POST /api/apps/1/exclude-in-app-refresh HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "entityKey": "1-1"
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success"
}

应用刷新时包含这个数据集

请求URL

http
POST /api/apps/{appId}/include-in-app-refresh HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体
字段类型描述
entityKeySTRING被包含的数据集的执行计划的entityKey,不包含这个字段,表示全部

返回对象的格式说明

字段类型描述
msgSTRING执行成功返回 success

接口示例1 禁用app id为1的所有单个数据集更新计划

http
POST /api/apps/1/include-in-app-refresh HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "entityKey": "1-1"
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success"
}

查询应用中单个数据的执行计划列表

请求URL

http
GET /api/apps/{appId}/dataset-schedules HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
appIdINTEGER应用的 id
includeInAppScopeBOOL可选本dataset是否包括在app scope刷新中
qSTRING可选搜索关键字

返回对象的格式说明

查询执行计划列表 返回数据一致,多一个字段:

字段类型是否必须说明
includeInAppScopeBOOL可选本dataset是否包括在app scope刷新中

接口示例1

http
GET /api/apps/1/dataset-schedules HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "code": 0,
  "data": [
    {
      "id": 1,
      "entityGroup": "DATASET",
      "entityKey": "1-1",
      "enabled": false,
      "planItems": [
        {
          "id": 1,
          "triggerType": "CRON_JOB",
          "cronDesc": "0 15 0 ? * 1",
          "cronType": "WEEKLY",
          "timeZone": "GMT+08:00"
        },
        {
          "id": 2,
          "triggerType": "CRON_JOB",
          "cronDesc": "*/30 * * * * ?",
          "cronType": "CRON",
          "timeZone": "GMT+08:00"
        }
      ],
      "execDetail": {
        "jobClass": "com.hengshi.nangaparbat.schedulejob.DatasetJob",
        "jobParams": {
          "app": 1,
          "dataset": 1
        },
        "retryTimes": 1
      },
      "title": "dataset1",
      "createdAt": "2020-03-05 15:01:02",
      "createdBy": 1,
      "updatedAt": "2020-03-05 15:01:02",
      "updatedBy": 1
    }
  ],
  "msg": "success",
  "version": "version@9a5e106#6730f0d",
  "totalHits": 1,
  "offset": 0
}

查询应用刷新的执行计划

请求URL

http
GET /api/apps/{appId}/refresh-schedule HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
appIdINTEGER应用的 id

返回对象的格式说明

查询执行计划列表 返回数据一致,只有一个执行计划object

接口示例1

http
GET /api/apps/1/refresh-schedule HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "code": 0,
  "data": {
    "id": 1,
    "entityGroup": "APP_REFRESH",
    "entityKey": "1",
    "enabled": false,
    "planItems": [
      {
        "id": 1,
        "triggerType": "CRON_JOB",
        "cronDesc": "0 15 0 ? * 1",
        "cronType": "WEEKLY",
        "timeZone": "GMT+08:00"
      },
      {
        "id": 2,
        "triggerType": "CRON_JOB",
        "cronDesc": "*/30 * * * * ?",
        "cronType": "CRON",
        "timeZone": "GMT+08:00"
      }
    ],
    "execDetail": {
      "jobClass": "com.hengshi.nangaparbat.schedulejob.AppDatasetRefreshJob",
      "jobParams": {
        "app": 1
      },
      "retryTimes": 1
    },
    "title": "app1",
    "createdAt": "2020-03-05 15:01:02",
    "createdBy": 1,
    "updatedAt": "2020-03-05 15:01:02",
    "updatedBy": 1
  },
  "msg": "success",
  "version": "version@9a5e106#6730f0d",
  "totalHits": 1,
  "offset": 0
}

创建自助查询应用的用户设置

请求URL

http
GET /api/apps/{appId}/profiles HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
appIdINTEGER应用的 id

返回对象的格式说明

查询执行计划列表 返回数据一致,只有一个执行计划object

接口示例1

http
GET /api/apps/1/refresh-schedule HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "code": 0,
  "data": {
    "id": 1,
    "entityGroup": "APP_REFRESH",
    "entityKey": "1",
    "enabled": false,
    "planItems": [
      {
        "id": 1,
        "triggerType": "CRON_JOB",
        "cronDesc": "0 15 0 ? * 1",
        "cronType": "WEEKLY",
        "timeZone": "GMT+08:00"
      },
      {
        "id": 2,
        "triggerType": "CRON_JOB",
        "cronDesc": "*/30 * * * * ?",
        "cronType": "CRON",
        "timeZone": "GMT+08:00"
      }
    ],
    "execDetail": {
      "jobClass": "com.hengshi.nangaparbat.schedulejob.AppDatasetRefreshJob",
      "jobParams": {
        "app": 1
      },
      "retryTimes": 1
    },
    "title": "app1",
    "createdAt": "2020-03-05 15:01:02",
    "createdBy": 1,
    "updatedAt": "2020-03-05 15:01:02",
    "updatedBy": 1
  },
  "msg": "success",
  "version": "version@9a5e106#6730f0d",
  "totalHits": 1,
  "offset": 0
}

复制应用

请求URL

http
POST /api/apps/{appId}/duplicate HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
request body 请求体
字段类型描述
targetFolderIdLONG复制到目录的id,不包含这个字段,表示和源应用同一目录
titleString新应用名称,可不传

返回对象的格式说明

应用结构说明

接口示例1 在应用创作区创建应用副本

http
POST /api/apps/1/duplicate HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 43417,
    "title": "duplicate app",
    "cover": "",
    "options": {
      "dashboards": [
        1
      ],
      "datasets": [
      ],
      "dashboardsOrder": [
        1
      ],
      "enableAppRule": false,
      "enableRuleStrictValidate": false,
      "pagination": {
        "applyToDashboards": [
          1,
          1
        ]
      },
      "devices": {
        "pc": true,
        "mobile": false
      },
      "resultCacheInterval": 3600
    },
    "createdBy": 1337,
    "createdAt": "2022-12-29 15:24:18",
    "updatedBy": 1337,
    "updatedAt": "2022-12-29 15:24:18",
    "visible": true,
    "isDelete": false,
    "isPublish": false,
    "isBackup": false,
    "folderId": 0,
    "area": "PERSONAL_AREA",
    "dataMode": "APP_MODE",
    "emailOptions": {
    },
    "type": "ANALYTIC_APP",
    "datasets": [
    ],
    "publishState": false
  }
}

接口示例2 在应用集市区使用模版新建应用

http
POST /api/apps/2/duplicate HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
  1. 响应结果 和接口示例1返回数据一致

接口示例3 在应用创作区将应用复制到指定目录下

http
POST /api/apps/3/duplicate HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "targetFolderId": 0,
  "title": "duplicate app"
}
  1. 响应结果 和接口示例1返回数据一致

使用模板覆盖当前应用

请求URL

http
POST /api/apps/{appId}/overwrite HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
fileBINARY必填, 模版文件流
copyBOOLEAN必填, 是否备份当前应用
overwriteAuthBOOLEAN非 必填, 是否覆盖当前应用的权限配置

返回对象的格式说明

应用结构说明

接口示例1 使用模板覆盖当前应用

http
POST /api/apps/1/overwrite?copy=false HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 128207,
    "title": "book",
    "cover": "",
    "options": {
      "dashboards": [
        1,
        2
      ],
      "datasets": [
        2,
        1,
        3
      ],
      "dashboardsOrder": [
        1,
        2
      ],
      "appTemplateUUID": "25d659a1-f6d4-4d95-94fc-e80a018d59a3",
      "enableAppRule": false,
      "enableRuleStrictValidate": true,
      "pagination": {
        "undefined": {}
      },
      "devices": {
        "pc": true,
        "mobile": false
      },
      "resultCacheInterval": 3600
    },
    "createdBy": 8,
    "createdAt": "2023-06-24 17:44:10",
    "updatedBy": 8,
    "updatedAt": "2023-08-11 01:00:09",
    "visible": true,
    "isDelete": false,
    "isPublish": false,
    "isBackup": false,
    "folderId": 0,
    "area": "PERSONAL_AREA",
    "dataMode": "APP_MODE",
    "emailOptions": {},
    "type": "ANALYTIC_APP",
    "datasets": [
      2,
      1,
      3
    ],
    "publishState": false,
    "hideDatasets": [],
    "status": "RUNNING"
  },
  "chartDataStartTimeMillis": 0
}

暂停/恢复APP

请求URL

http
POST /api/apps/{appId}/pending HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

url 参数
字段类型描述
appIdINTEGER应用的 id
statusSTRING必填, 要修改的应用状态,可选值:PENDING

返回对象的格式说明

应用结构说明

接口示例1 使用模板覆盖当前应用

http
POST /api/apps/1/pending?status=pending HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 128207,
    "title": "book",
    "cover": "",
    "options": {
      "dashboards": [
        1,
        2
      ],
      "datasets": [
        2,
        1,
        3
      ],
      "dashboardsOrder": [
        1,
        2
      ],
      "appTemplateUUID": "25d659a1-f6d4-4d95-94fc-e80a018d59a3",
      "enableAppRule": false,
      "enableRuleStrictValidate": true,
      "pagination": {
        "undefined": {}
      },
      "devices": {
        "pc": true,
        "mobile": false
      },
      "resultCacheInterval": 3600
    },
    "createdBy": 8,
    "createdAt": "2023-06-24 17:44:10",
    "updatedBy": 8,
    "updatedAt": "2023-08-11 01:00:09",
    "visible": true,
    "isDelete": false,
    "isPublish": false,
    "isBackup": false,
    "folderId": 0,
    "area": "PERSONAL_AREA",
    "dataMode": "APP_MODE",
    "emailOptions": {},
    "type": "ANALYTIC_APP",
    "datasets": [
      2,
      1,
      3
    ],
    "publishState": false,
    "hideDatasets": [],
    "status": "PENDING"
  },
  "chartDataStartTimeMillis": 0
}

GET 获取指定用户创建的所有APP

获取指定用户创建的所有APP。针对SYSTEM_PORTAL、PUBLIC_AREA、DATA_MART的中的APP需要当前发起请求的用户拥有系统管理员以及数据管理员角色,当请求中显示指定了用户时则返回指定用户创建的所有应用,否则返回当前用户创建的所有应用。当指定非当前用户时, area取值只能是 SYSTEM_PORTAL | PUBLIC_AREA | DATA_MART之一。

请求参数

名称位置类型必选说明
createdByqueryinteger指定用户ID
creatorEmailqueryinteger指定用户绑定电子邮箱
creatorMobilequeryinteger指定用户绑定手机号码
creatorLoginNamequeryinteger指定用户登陆名
areaquerystring指定区域,可选项:SYSTEM_PORTAL、PUBLIC_AREA、DATA_MART、PERSONAL_AREA、APP_MART
orderByquerystring排序字段
orderTypequerystring排序方式
offsetquerystring分页偏移量
limitquerystring分页大小
http
GET /api/apps/created-list?area=SYSTEM_PORTAL&orderBy=createdAt&orderType=desc&offset=0&limit=10 HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "code": 0,
  "msg": "success",
  "data": [
    {
      "id": 72,
      "title": "常驻",
      "cover": "",
      "options": {
        "dashboardsOrder": [],
        "enableRuleStrictValidate": true,
        "devices": {
          "pc": true,
          "mobile": true
        }
      },
      "createdBy": 7,
      "createdAt": "2022-09-28 16:52:28",
      "updatedBy": 7,
      "updatedAt": "2022-09-28 16:52:28",
      "latestAuthorizedBy": 2,
      "latestAuthorizedAt": "2022-09-28 16:40:03",
      "visible": true,
      "isDelete": false,
      "isPublish": false,
      "isBackup": false,
      "folderId": 17,
      "area": "DATA_MART",
      "dataMode": "APP_MODE",
      "emailOptions": {},
      "type": "DATA_APP",
      "publishState": false,
      "hideDatasets": [
        2
      ],
      "status": "RUNNING",
      "creator": {
        "id": 7,
        "name": "xf1",
        "email": "xf1dgfhijoiwjgiowhoughodhgdhsg@fffqqda.com",
        "loginName": "xf1"
      },
      "updater": {
        "id": 7,
        "name": "xf1",
        "email": "xf1dgfhijoiwjgiowhoughodhgdhsg@fffqqda.com",
        "loginName": "xf1"
      },
      "refreshExecDetail": {
        "jobClass": "com.hengshi.nangaparbat.schedulejob.AppDatasetRefreshJob",
        "jobParams": {
          "app": 72
        },
        "retryTimes": 1
      },
      "refreshEntityGroup": "APP_REFRESH",
      "entityKey": "72",
      "entityGroup": "APP_EMAIL",
      "execDetail": {
        "jobClass": "com.hengshi.nangaparbat.schedulejob.AppEmailJob",
        "jobParams": {
          "app": 72
        },
        "retryTimes": 1
      }
    },
    {
      "id": 73,
      "title": "常驻1",
      "cover": "",
      "options": {
        "dashboardsOrder": [],
        "enableRuleStrictValidate": true,
        "devices": {
          "pc": true,
          "mobile": true
        }
      },
      "createdBy": 7,
      "createdAt": "2022-09-28 16:53:29",
      "updatedBy": 7,
      "updatedAt": "2022-09-28 16:54:14",
      "latestAuthorizedBy": 2,
      "latestAuthorizedAt": "2022-09-28 16:40:03",
      "visible": true,
      "isDelete": false,
      "isPublish": false,
      "isBackup": false,
      "folderId": 17,
      "area": "DATA_MART",
      "dataMode": "APP_MODE",
      "emailOptions": {},
      "type": "DATA_APP",
      "publishState": false,
      "hideDatasets": [
        2
      ],
      "status": "RUNNING",
      "creator": {
        "id": 7,
        "name": "xf1",
        "email": "xf1dgfhijoiwjgiowhoughodhgdhsg@fffqqda.com",
        "loginName": "xf1"
      },
      "updater": {
        "id": 7,
        "name": "xf1",
        "email": "xf1dgfhijoiwjgiowhoughodhgdhsg@fffqqda.com",
        "loginName": "xf1"
      },
      "refreshExecDetail": {
        "jobClass": "com.hengshi.nangaparbat.schedulejob.AppDatasetRefreshJob",
        "jobParams": {
          "app": 73
        },
        "retryTimes": 1
      },
      "refreshEntityGroup": "APP_REFRESH",
      "entityKey": "73",
      "entityGroup": "APP_EMAIL",
      "execDetail": {
        "jobClass": "com.hengshi.nangaparbat.schedulejob.AppEmailJob",
        "jobParams": {
          "app": 73
        },
        "retryTimes": 1
      }
    }
  ],
  "totalHits": 14,
  "offset": 0,
  "chartDataStartTimeMillis": 0
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgstringtruenonenone
» data[object]truenonenone
»» idintegertruenonenone
»» titlestringtruenonenone
»» coverstringtruenonenone
»» optionsobjecttruenonenone
»»» dashboardsOrder[string]truenonenone
»»» enableRuleStrictValidatebooleantruenonenone
»»» devicesobjecttruenonenone
»»»» pcbooleantruenonenone
»»»» mobilebooleantruenonenone
»» createdByintegertruenonenone
»» createdAtstringtruenonenone
»» updatedByintegertruenonenone
»» updatedAtstringtruenonenone
»» latestAuthorizedByintegertruenonenone
»» latestAuthorizedAtstringtruenonenone
»» visiblebooleantruenonenone
»» isDeletebooleantruenonenone
»» isPublishbooleantruenonenone
»» isBackupbooleantruenonenone
»» folderIdintegertruenonenone
»» areastringtruenonenone
»» dataModestringtruenonenone
»» emailOptionsobjecttruenonenone
»» typestringtruenonenone
»» publishStatebooleantruenonenone
»» hideDatasets[integer]truenonenone
»» statusstringtruenonenone
»» creatorobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» emailstringtruenonenone
»»» loginNamestringtruenonenone
»» updaterobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» emailstringtruenonenone
»»» loginNamestringtruenonenone
»» refreshExecDetailobjecttruenonenone
»»» jobClassstringtruenonenone
»»» jobParamsobjecttruenonenone
»»»» appintegertruenonenone
»»» retryTimesintegertruenonenone
»» refreshEntityGroupstringtruenonenone
»» entityKeystringtruenonenone
»» entityGroupstringtruenonenone
»» execDetailobjecttruenonenone
»»» jobClassstringtruenonenone
»»» jobParamsobjecttruenonenone
»»»» appintegertruenonenone
»»» retryTimesintegertruenonenone
» totalHitsintegertruenonenone
» offsetintegertruenonenone
» chartDataStartTimeMillisintegertruenonenone

应用/应用版本管理

GET 获取应用备份版本个数

查询当前app应用备份版本个数。

请求参数

名称位置类型必选说明
appIdpathstringnone
http
GET /api/apps/{appId}/backups/count HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": 3,
  "chartDataStartTimeMillis": 0
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» versionstringtruenonenone
» codeintegertruenonenone
» msgstringtruenonenone
» dataintegertruenonenone
» chartDataStartTimeMillisintegertruenonenone

GET 获取应用备份列表

查询当前app备份信息。

请求参数

名称位置类型必选说明
appIdpathstringnone
orderByquerystringnone
limitquerystringnone
orderTypequerystringnone
offsetquerystringnone
http
GET /api/apps/{appId}/backups HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": "laborum",
  "code": 46,
  "msg": "mollit occaecat",
  "data": [
    {
      "id": 47,
      "appId": 36,
      "backupAppId": 85,
      "title": "基到大级",
      "createdBy": 99,
      "createdAt": "2010-05-18 09:08:54",
      "updatedBy": 64,
      "updatedAt": "1972-02-17 16:35:21",
      "isDeleted": false,
      "creator": {
        "id": 9,
        "name": "很知际快较量",
        "loginName": "及不三给于"
      },
      "updater": {
        "id": 23,
        "name": "即级风看以",
        "loginName": "把是们适我改已"
      }
    }
  ],
  "chartDataStartTimeMillis": 92027862253
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» versionstringtruenonenone
» codeintegertruenonenone
» msgstringtruenonenone
» data[object]truenonenone
»» idintegertruenonenone
»» appIdintegertruenone当前应用id
»» backupAppIdintegertruenone备份应用id
»» titlestringtruenone备份记录标题
»» createdByintegertruenone备份记录创建者
»» createdAtstringtruenone备份记录创建时间
»» updatedByintegertruenone备份记录最后一次修改者
»» updatedAtstringtruenone备份记录最后一次修改时间
»» isDeletedbooleantruenonenone
»» creatorobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» loginNamestringtruenonenone
»» updaterobjecttruenonenone
»»» idintegertruenonenone
»»» namestringtruenonenone
»»» loginNamestringtruenonenone
» chartDataStartTimeMillisintegertruenonenone

DELETE 删除备份

删除指定的app的指定备份文件。

请求参数

名称位置类型必选说明
appIdpathstring应用id
backupIdpathstring应用备份记录id
http
DELETE /api/apps/{appId}/backups/{backupId} HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "chartDataStartTimeMillis": 0
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

PUT 更新备份记录信息

更新指定app的指定备份记录信息。更新的是备份记录信息,并不是副本本身。

请求参数

名称位置类型必选说明
appIdpathstring应用id
backupIdpathstring应用备份记录id
bodybodyobjectnone
» titlebodystringnone
http
PUT /api/apps/{appId}/backups/{backupId} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "title": "1号备份"
}
http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 0,
  "msg": "success",
  "data": {
    "id": 1958,
    "appId": 112326,
    "backupAppId": 129217,
    "title": "1号备份",
    "backupConfig": {
      "planDtos": []
    },
    "createdBy": 26889,
    "createdAt": "2023-08-11 11:50:26",
    "updatedBy": 26889,
    "updatedAt": "2023-08-11 12:17:31",
    "isDeleted": false
  },
  "chartDataStartTimeMillis": 0
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

GET 重置

http
GET /api/apps/{appId}/backups/{backupId}/restore HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

将指定app重置到指定的备份版本。

说明

应用版本仅保留数据分析相关的所有内容:仪表盘、数据集、数据模型、参数、翻页器等,涉及到连接、权限相关的设置则无法保留。 应用发布时自动保留版本,仅保留最近的若干版本。更早的版本将被自动删除。

请求参数

名称位置类型必选说明
appIdpathstringnone
backupIdpathstringnone

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

应用/导入导出

GET 导出应用模板

http
GET /api/apps/{appId}/export-template HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

名称位置类型必选说明
appIdpathstringnone
exportAuthquerystring要导出的模版版本,若要将模版导入3.6或3.6之前的系统,则需要传3.6
tplVersionquerystring是否要导出应用的授权 & 权限模式 & 行权限信息,个人区需应用作者才能导出,公共区需应用管理员才能导出

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

POST 校验应用模板

在导入模板之前应先调用该API对要进行导入的模板文件进行校验。

请求参数

名称位置类型必选说明
areaquerystring目标区域
http
POST /api/apps/import-template-validate HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...
http
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "version": "version@9a5e106#6730f0d",
  "code": 10273,
  "msg": "模板中不含权限规则和授权信息,\"数据权限\"部分的设定将按模板配置",
  "error": "error/app-template-not-contains-auth-info",
  "errorMap": {},
  "debug": "error/app-template-not-contains-auth-info",
  "chartDataStartTimeMillis": 0
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline
400Bad Request模板中存在错误Inline

返回数据结构

POST 导入模板

根据导入的模板文件创建app。

http
POST /api/apps/import-template HTTP/1.1
Accept: application/json
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarywj9aABghi7jHeyqX
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

file:
------WebKitFormBoundarywj9aABghi7jHeyqX
Content-Disposition: form-data; name="file"; filename="HengShi App.hstpl"
Content-Type: application/octet-stream
------WebKitFormBoundarywj9aABghi7jHeyqX--

请求参数

名称位置类型必选说明
folderIdquerystring可选, 文件夹id,如果为空,就导入个人区
importAuthquerystring是否导入应用授权 & 权限模式 & 行权限信息
bodybodyobjectnone
» filebodystring(binary)模板文件

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

POST 使用模板替换应用

使用提供的模板替换指定应用。

http
POST /api/apps/{appId}/overwrite HTTP/1.1
Accept: application/json
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarywj9aABghi7jHeyqX
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

file:
------WebKitFormBoundarywj9aABghi7jHeyqX
Content-Disposition: form-data; name="file"; filename="HengShi App.hstpl"
Content-Type: application/octet-stream
------WebKitFormBoundarywj9aABghi7jHeyqX--

请求参数

名称位置类型必选说明
appIdpathstringnone
copyquerystring是否同时创建副本
overwriteAuthquerystring是否覆盖权限配置信息
bodybodyobjectnone
» filebodystring(binary)模板文件

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

应用/批量操作

批量操作有以下几种类型:

  • 普通操作
    1. move
    2. delete
    3. update
    4. visible
  • 文件导出操作
    1. export-template

所有类型在批量操作预检查API中均可用,在具体执行批量操作的接口中会有区分。

说明

普通操作只能在'批量操作'API中使用。 文件导出操作只能在'批量导出操作'API中使用。

各操作支持执行对象

说明

每一种操作并不一定对所有的对象就支持,特定的对象只支持特定的操作。

下面列出每一种对象支持的操作:

/folderappdatasetchartdashboardfieldmetricapp param
moveyy//////
deleteyy///yyy
update/////yy/
visible/////y//
export-template/y//////

POST 批量操作预检查

执行批量操作之前,调用该API对该操作进行合法性校验。

http
POST /api/batch/check/{batch-operation} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "items": [
    {
      "objectType": "app",
      "idSet": [
        112326,
        129220
      ]
    }
  ],
  "args": {
    "tplVersion": "4.5",
    "exportAuth": true
  }
}

请求参数

名称位置类型必选说明
batch-operationpathstring批量操作类型
bodybodyobjectnone
» itemsbody[object]批量操作对象列表
»» objectTypebodystring批量操作对象类型
»» idSetbody[string]批量操作对象唯一标识集合
» argsbodyobject批量操作额外变量
»» tplVersionbodystringnone
»» exportAuthbodybooleannone

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

POST 批量导出操作

http
POST /api/batch/export/{export-operation} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "items": [
    {
      "objectType": "app",
      "idSet": [
        112326,
        129220
      ]
    }
  ],
  "args": {
    "tplVersion": "4.5",
    "exportAuth": true
  }
}

请求参数

名称位置类型必选说明
export-operationpathstring批量导出操作
bodybodyobjectnone
» itemsbody[object]none
»» objectTypebodystringnone
»» idSetbody[string]none
» argsbodyobjectnone
»» tplVersionbodystringnone
»» exportAuthbodybooleannone

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

POST 批量操作

执行批量操作

请求参数

名称位置类型必选说明
batch-operationpathstring批量操作类型
bodybodyobjectnone
» itemsbody[object]none
»» objectTypebodystringnone
»» idSetbody[string]none
» argsbodyobjectnone
»» targetIdbodyintegernone
»» keepAuthbodybooleannone
http
POST /api/batch/operation/{batch-operation} HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
  "items": [
    {
      "objectType": "app",
      "idSet": [
        129052
      ]
    }
  ],
  "args": {
    "targetId": 3270,
    "keepAuth": false
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
  "code": 0,
  "msg": "success",
  "data": {
    "items": [
      {
        "objectType": "app",
        "successIdSet": [
          129052
        ]
      }
    ]
  },
  "chartDataStartTimeMillis": 0
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgstringtruenonenone
» dataobjecttruenonenone
»» items[object]truenonenone
»»» objectTypestringfalsenonenone
»»» successIdSet[integer]falsenonenone
» chartDataStartTimeMillisintegertruenonenone

HENGSHI SENSE API 使用手册