# 分析计算任务

# 获取分析计算任务列表

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/list

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
search String - 搜索的文本
sortField String createdAt 排序的字段
sortType String desc 排序的类型
offset Number - 返回结果的偏移量,用于分页
limit Number - 返回结果的数量,用于分页

# 请求示例

GET http://host:port/heycloud/api/analytics/job/list?search=xx&offset=0&limit=11

# 正确响应示例:

{
  "result": [
    {
      "id": "cb88724f-b304-4e2e-98d4-aaa06d308975",
      "accountId": "",
      "title": "222",
      "type": "flow",
      "createdAt": "2021-04-07T07:06:05.267Z",
      "updatedAt": null,
      "startAt": "2021-04-07T07:06:05.418Z",
      "endAt": null,
      "status": "running"
    }
  ]
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 创建一个分析计算的任务

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/create

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
title String - 任务标题
type String - 分析任务的类型
definition Object - 定义工作流 具体配置见definition 配置

# 请求示例

POST http://host:port/heycloud/api/analytics/job/create

{
  "title": "提取北京小区数据",
  "type": "flow",
  "definition": {
    "nodes": {
      "node-1": {
        "name": "io/extractVdataset",
        "title": "北京小区",
        "settings": {
          "vdatasetId": "xxx",
          "where": "\"id\"<10"
        }
      },
      "node-2": {
        "name": "transform/ChinaOffset",
        "title": "坐标偏移"
      }
    },
    "links": [
      {
        "from": { "nodeId": "node-1", "outPort": 0 },
        "to": { "nodeId": "node-2", "inPort": 0 }
      }
    ],
    "results": [{ "nodeId": "node-2", "outPort": 0 }]
  }
}

# 正确响应示例:

{
  "result": {
    "jobId": "ff6cb32c-5b6d-4e5a-a102-75b8d1ff5bf5",
    "notifyAt": "2021-04-08T02:59:35.109Z"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 获取某个任务的信息

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID

# 请求示例

GET http://host:port/heycloud/api/analytics/job/xxxxx

# 正确响应示例:

{
  "result": {
    "id": "8ebc011d-3548-4441-bd6e-34616ffc4ac9",
    "accountId": "",
    "title": "ccc",
    "type": "flow",
    "definition": {},
    "createdAt": "2021-04-02T03:35:34.762Z",
    "updatedAt": null,
    "startAt": "2021-04-02T03:35:34.958Z",
    "endAt": "2021-04-02T03:35:35.766Z",
    "status": "error"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 获取某个任务的运行状态

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId/status

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID

# 请求示例

GET http://host:port/heycloud/api/analytics/job/xxxxx/status

# 正确响应示例:

{
  "result": {
    "jobId": "331acfb3-da4f-40dc-ab61-5d2a241e9933",
    "nodesStatus": { "node-1": "success", "node-3": "error" },
    "portsStatus": { "node-3:0": "ready" },
    "updatedAt": "2021-05-12T07:42:27.520Z"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 获取某个任务的某个结果

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId/result/:resultIdx

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID
resultIdx String - 结果序号

# 请求示例

GET http://host:port/heycloud/api/analytics/job/:jobId/result/:resultIdx

# 正确响应示例:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": { "prop0": "point", "height": 100, "prop1": null },
      "geometry": { "type": "Point", "coordinates": [117, 32] }
    }
  ],
  "crs": { "type": "name", "properties": { "name": "epsg:4326" } }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 获取执行某个任务发生的错误

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId/errors

# 请求方式:

  • GET

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID

# 请求示例

GET http://host:port/heycloud/api/analytics/job/xxxxx/errors

# 正确响应示例:

{
  "result": [
    {
      "id": "2e701e97-9fb1-4e4e-abda-95c5d63d2f33",
      "jobId": "af4e58b8-be9e-43be-8caf-30144ba2a8c9",
      "accountId": "",
      "code": null,
      "message": "ID 为 3055e1f5-1067-46ba-aee9-e0018571886f 的数据集不存在",
      "createdAt": "2021-04-08T03:27:11.042Z"
    }
  ]
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 更新任务的标题

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId/updateTitle

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID
title String - 更新的标题

# 请求示例

POST http://host:port/heycloud/api/analytics/job/xxxxx/updateTitle

{
  title: "xxx"
}

# 正确响应示例:

{
  "result": {
    "title": "rrrrf"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 管理员将无主任务分配给某个帐号

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId/assign

# 请求方式:

  • POST

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID
accountId String - 需要分配给的帐号

# 请求示例

POST http://host:port/heycloud/api/analytics/job/xxxxx/assign

{
  accountId: "xxx"
}

# 正确响应示例:

{
  "result": {
    "accountId": "xxx"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}

# 删除某个任务及其所有相关的资源

# 请求 URL:

  • http://host:port/heycloud/api/analytics/job/:jobId

# 请求方式:

  • DELETE

# 请求 Header:

字段 类型 是否必选 说明
x-heycloud-admin-session String 通过 session 提供管理权限
x-heycloud-account-id String 帐号的唯一标识符

# 请求参数:

参数名称 类型 是否必须 默认值 说明
jobId String - 任务 ID

# 请求示例

DELETE http://host:port/heycloud/api/analytics/job/xxxxx

# 正确响应示例:

{
  "result": {
    "id": "af4e58b8-be9e-43be-8caf-30144ba2a8c9",
    "deletedAt": "2021-04-08T03:43:12.804Z"
  }
}

# 错误响应示例:

{
  "error": "ERROR",
  "message": "错误信息"
}