Skip to content

笔记

笔记说明

笔记定义

笔记是多个代码片段的集合,每个片段称为一个段落。这些有关联的段落顺序执行来完成特定的数据处理功能。给笔记设定执行计划,可以实现周期性的数据处理。

笔记结构说明

字段类型描述
idINTEGER笔记的 id
titleSTRING笔记的标题
createdAtDATETIME笔记创建的时间
createdByINTEGER笔记创建用户的 id
updatedAtDATETIME笔记最后修改的时间
updatedByINTEGER笔记最后修改用户的 id
transactionModeSTRING笔记的事务模式,见事务模式说明
entityGroupSTRING笔记的执行计划类别,用于管理执行计划,固定为notebook
entityKeySTRING笔记的执行计划关键字,用于管理执行计划
execDetailOBJECT创建执行计划需要用到的任务描述信息,详见执行计划

笔记事务模式说明

状态值意义
BY_NOTEBOOK整个笔记作为一个事务, 默认值
BY_PARAGRAPH每个段落作为一个事务

笔记连接列表结构说明

字段类型描述
notebookIdINTEGER所属笔记的 id
connectionIdINTEGER连接的 id
createdAtDATETIME添加连接的时间
createdByINTEGER添加连接用户的 id
statusSTRING连接授权状态,见连接授权状态说明

笔记连接授权状态说明

状态值意义
VALID已经授权,有效
INVALID尚未授权,无效

接口说明

新增笔记

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述
titleSTRING笔记的标题
transactionModeSTRING可选笔记的事务模式,见事务模式说明

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT笔记结构说明

接口示例:

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

// Request Body:
{
    "title": "notebook1",
    "transactionMode": "BY_PARAGRAPH"
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
    "code": 0,
    "data": {
        "id": 1,
        "title": "notebook1",
        "createdBy": 1,
        "createdAt": "2020-02-25 17:19:40",
        "updatedBy": 1,
        "updatedAt": "2020-02-25 17:19:40",
        "transactionMode": "BY_PARAGRAPH",
        "entityGroup": "notebook",
        "entityKey": "1"
    },
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
}

删除笔记

请求URL

http
DELETE /api/notebooks/{notebookId} HTTP/1.1
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
code错误码请求成功返回0
msgSTRING请求成功返回success

接口示例:

http
DELETE /api/notebooks/{notebookId} HTTP/1.1
http
HTTP/1.1 200 Ok
Content-Type: application/json

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

修改笔记

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数

只能修改title或者transactionMode,或者同时修改,不能全部为(空或者null)

字段类型是否必须描述
titleSTRING可选笔记的标题
transactionModeSTRING可选笔记的事务模式,见事务模式说明

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT笔记结构说明

接口示例:

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

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

{
    "code": 0,
    "data": {
        "id": 1,
        "title": "notebook new title",
        "createdBy": 1,
        "createdAt": "2020-02-25 17:19:40",
        "updatedBy": 1,
        "updatedAt": "2020-02-25 17:19:40",
        "transactionMode": "BY_PARAGRAPH",
        "entityGroup": "notebook",
        "entityKey": "1"
    },
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
}

获取笔记

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT笔记结构说明

接口示例:

http
GET /api/notebooks/{notebookId} 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,
        "title": "notebook1",
        "createdBy": 1,
        "createdAt": "2020-02-25 17:19:40",
        "updatedBy": 1,
        "updatedAt": "2020-02-25 17:19:40",
        "transactionMode": "BY_PARAGRAPH",
        "entityGroup": "notebook",
        "entityKey": "1"
    },
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
}

获取笔记列表

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
offsetINTEGER可选分页偏移量,默认是0
limitINTEGER可选分页获取个数,默认是10
Request Body 参数
字段类型是否必须描述

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
totalHitsINTEGER笔记的总个数
offsetINTEGER当前分页偏移量
dataOBJECT 数组数组的元素是一个笔记,见笔记结构说明

接口示例:

http
GET /api/notebooks 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,
            "title": "notebook1",
            "createdBy": 1,
            "createdAt": "2020-02-25 17:19:40",
            "updatedBy": 1,
            "updatedAt": "2020-02-25 17:19:40",
            "transactionMode": "BY_PARAGRAPH",
            "entityGroup": "notebook",
            "entityKey": "1"
        },
        {
            "id": 2,
            "title": "notebook2",
            "createdBy": 1,
            "createdAt": "2020-02-26 17:19:40",
            "updatedBy": 1,
            "updatedAt": "2020-02-26 17:19:40",
            "transactionMode": "BY_NOTEBOOK",
            "entityGroup": "notebook",
            "entityKey": "2"
        }
    ],
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
    "totalHits": 2,
    "offset": 0
}

新增笔记的可用连接

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述
connectionIdINTEGER连接的 id
statusSTRING可选连接授权状态,见连接授权状态说明 ,默认是INVALID

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT笔记连接列表结构说明

接口示例:

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

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

{
    "code": 0,
    "data": {
        "notebookId": 1,
        "connectionId": 1,
        "createdBy": 1,
        "createdAt": "2020-02-25 17:19:40",
        "status": "INVALID"
    },
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
}

删除笔记的可用连接

请求URL

http
DELETE /api/notebooks/{notebookId}/connections/{connectionId} HTTP/1.1
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
code错误码请求成功返回0
msgSTRING请求成功返回success

接口示例:

http
DELETE /api/notebooks/{notebookId}/connections/{connectionId} HTTP/1.1
http
HTTP/1.1 200 Ok
Content-Type: application/json

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

修改笔记的可用连接

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数

只能修改status

字段类型是否必须描述
statusSTRING连接授权状态,见连接授权状态说明

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT笔记连接列表结构说明

接口示例:

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

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

{
    "code": 0,
    "data": {
        "notebookId": 1,
        "connectionId": 1,
        "createdBy": 1,
        "createdAt": "2020-02-26 17:19:40",
        "status": "VALID"
    },
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
}

获取笔记的可用连接列表

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
offsetINTEGER可选分页偏移量,默认是0
limitINTEGER可选分页获取个数,默认是10
Request Body 参数
字段类型是否必须描述

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
totalHitsINTEGER笔记的总个数
offsetINTEGER当前分页偏移量
dataOBJECT 数组数组的元素是一个笔记,见笔记连接列表结构说明

接口示例:

http
GET /api/notebooks/{notebookId}/connections 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": [
        {
            "notebookId": 1,
            "connectionId": 1,
            "createdBy": 1,
            "createdAt": "2020-02-26 17:19:40",
            "status": "VALID"
        },
        {
            "notebookId": 1,
            "connectionId": 2,
            "createdBy": 1,
            "createdAt": "2020-02-27 17:19:40",
            "status": "INVALID"
        }
    ],
    "msg": "success",
    "version": "version@9a5e106#6730f0d",
    "totalHits": 2,
    "offset": 0
}

获取笔记的连接的表格目录

请求URL

http
GET /api/notebooks/{notebookId}/connections/{connectionId}/path-tables HTTP/1.1
Accept: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT 数组
data[].pathTypeSTRINGpath表示目录,table表示表格
data[].nameSTRING节点名字
data[].childrenOBJECT 数组只有pathType=path才有,递归结构,同data
data[].tableTypeSTRING只有pathType=table有,TABLE表示表格,VIEW表示视图

接口示例:

http
GET /api/notebooks/{notebookId}/connections/{connectionId}/path-tables 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": [
    {
      "pathType": "path",
      "name": "public",
      "children": [
        {
          "pathType": "table",
          "name": "auth",
          "tableType": "TABLE"
        },
        {
          "pathType": "table",
          "name": "barchart",
          "tableType": "TABLE"
        }
      ]
    }
  ]
}

获取笔记的连接的表格数据

请求URL

http
POST /api/notebooks/{notebookId}/connections/{connectionId}/path-table-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

URL 参数
字段类型是否必须说明
Request Body 参数
字段类型是否必须描述
tableSTRING表名
pathSTRING路径名

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT
data.schemaOBJECT数组字段描述
data.dataOBJECT数组数据

接口示例:

http
POST /api/notebooks/{notebookId}/connections/{connectionId}/path-table-data HTTP/1.1
Content-Type: application/json
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

// Request Body:
{
    "table":"auth",
    "path":["public"]
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

{
    "version": "version@9a5e106#6730f0d",
    "code":0,
    "msg":"success",
    "data":{
        "data":[
            [1,3,"group",0,"dataset","read|write"],
            [2,3,"group",0,"connection","read|write"],
            [3,3,"group",0,"chart","read|write"],
            [4,3,"group",0,"dashboard","read|write"],
            [5,3,"group",0,"notebook","read|write"],
            [6,3,"group",0,"paragraph","read|write"],
            [7,3,"group",0,"publish","read|write"],
            [8,1,"group",0,"user","read|write"],
            [9,1,"group",0,"configuration","read|write"]
        ],
        "schema":[
            {
                "fieldName":"id",
                "originType":"integer",
                "config":{"dialectName":"PostgresqlDialect"},
                "type":"number",
                "visible":true,
                "nativeType":"bigserial",
                "suggestedTypes":["number","string"],
                "detectedType":"integer",
                "defaultAggrType":"sum",
                "basicType":"number"
            },
            {
                "fieldName":"ident",
                "originType":"integer",
                "config":{"dialectName":"PostgresqlDialect"},
                "type":"number",
                "visible":true,
                "nativeType":"int8",
                "suggestedTypes":["number","string"],
                "detectedType":"integer",
                "defaultAggrType":"sum",
                "basicType":"number"
            },
            {
                "fieldName":"ident_type",
                "originType":"string",
                "config":{},
                "type":"string",
                "visible":true,
                "nativeType":"varchar",
                "suggestedTypes":["string"],
                "detectedType":"string",
                "defaultAggrType":"count",
                "basicType":"string"
            },
            {
                "fieldName":"object_id",
                "originType":"integer",
                "config":{"dialectName":"PostgresqlDialect"},
                "type":"number",
                "visible":true,
                "nativeType":"int8",
                "suggestedTypes":["number","string"],
                "detectedType":"integer",
                "defaultAggrType":"sum",
                "basicType":"number"
            },
            {
                "fieldName":"object_type",
                "originType":"string",
                "config":{},
                "type":"string",
                "visible":true,
                "nativeType":"varchar",
                "suggestedTypes":["string"],
                "detectedType":"string",
                "defaultAggrType":"count",
                "basicType":"string"
            },
            {
                "fieldName":"action",
                "originType":"string",
                "config":{},
                "type":"string",
                "visible":true,
                "nativeType":"varchar",
                "suggestedTypes":["string"],
                "detectedType":"string",
                "defaultAggrType":"count",
                "basicType":"string"
            }
        ],
        "pagable":true,
        "importSwitchable":true,
        "randomable":false
    }
}

HENGSHI SENSE API 使用手册