Skip to content

资源管理

资源说明

资源管理定义

资源管理用于批量删除、转移系统内不同用户的不同资源,资源包括:应用、链接、数据集成、数据科学

接口说明

  • 资源管理的所有接口都需要用户拥有系统管理员角色

获取资源列表

请求URL

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

请求参数

URL 参数
字段类型是否必须说明
typesSET<STRING>要查询的资源类型
userIdsSET<LONG>指定查询哪些用户下的资源
qSTRING搜索关键字
offsetINTEGER可选,分页字段,起始查询位置
limitINTEGER可选,分页字段,查询数量
orderBySTRING可选,排序字段,默认是按照更新时间降序排序
orderTypeSTRING可选,排序类型,asc - 表示升序,desc - 表示降序

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT每种应用参数的共同结构见应用参数结构说明

接口示例1: 获取资源列表

http
GET /api/resource-managements?offset=0&limit=20&types=connection&userIds=2&orderBy=type&orderType=asc&q=CA 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": 7,
      "title": "Local",
      "type": "connection",
      "createdBy": 2,
      "createdAt": "2020-05-26 14:59:12",
      "updatedBy": 2,
      "updatedAt": "2020-05-26 14:59:12",
      "creator": {
        "id": 2,
        "name": "test2",
        "email": "anonymous@hengshi.com"
      },
      "updater": {
        "id": 2,
        "name": "test2",
        "email": "anonymous@hengshi.com"
      }
    },
    {
      "id": 115,
      "title": "Local",
      "type": "connection",
      "createdBy": 2,
      "createdAt": "2020-05-26 14:57:58",
      "updatedBy": 2,
      "updatedAt": "2020-05-26 14:57:58",
      "creator": {
        "id": 2,
        "name": "test2",
        "email": "anonymous@hengshi.com"
      },
      "updater": {
        "id": 2,
        "name": "test2",
        "email": "anonymous@hengshi.com"
      }
    }
  ],
  "totalHits": 2,
  "offset": 0
}

资源转移

请求URL

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

请求参数

Request Body 参数
字段类型是否必须说明
targetUserIdLONG资源转移目标用户
resourceMapMAP<STRING, LIST<OBJECT>>被转移资源列表

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT每种应用参数的共同结构见应用参数结构说明

接口示例1: 资源转移

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

// Request Body:
{
  "targetUserId": 9,
  "resourceMap": {
    "app": [
      {
        "id": 31,
        "createdBy": 2
      }
    ],
    "notebook": [
      {
        "id": 8,
        "createdBy": 2
      }
    ],
    "connection": [
      {
        "id": 6,
        "createdBy": 2
      }
    ]
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

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

资源删除

请求URL

http
DELETE /api/resource-managements HTTP/1.1
Cookie: csrf=183f1c4...; sid=26ee552d...; _USER_SESSION_ID=f2a01083...

请求参数

Request Body 参数
字段类型是否必须说明
resourceMapMAP<STRING, LIST<OBJECT>>被转移资源列表

返回对象的格式说明

字段类型说明
versionSTRING当前系统版本哈希值
dataOBJECT每种应用的共同结构见应用参数结构说明

接口示例1: 资源删除

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

// Request Body:
{
  "resourceMap": {
    "app": [
      {
        "id": 31,
        "createdBy": 9
      }
    ],
    "notebook": [
      {
        "id": 8,
        "createdBy": 9
      }
    ],
    "connection": [
      {
        "id": 6,
        "createdBy": 9
      }
    ]
  }
}
http
HTTP/1.1 200 Ok
Content-Type: application/json

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

HENGSHI SENSE API 使用手册