# 通知

# 查询所有通知选项

# 请求 URL:

  • http://host:port/heycloud/api/base/notify/list

# 请求方式:

  • GET

# 请求 Header:

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

# 请求示例:

GET http://host:port/heycloud/api/base/notify/list

# 正确响应示例:

{
  "result": [
    {
      "id": "ff4da243-102f-4469-8d72-bb17f39e8dfe",
      "method": "email",
      "parameters": { "to": "", "from": "", "host": "", "port": 465, "user": "", "secure": true, "password": "123" },
      "createdAt": "2021-03-12T03:17:58.664Z"
    },
    { 
      "id": "32c01298-ec72-4637-8dcd-cd190cfe5d32", "method": "webhook", "parameters": { "url": "" }, "createdAt": "2021-03-12T03:18:00.333Z" 
    }
  ]
}

# 错误响应示例:

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

# 设置某种类型的通知选项,如存在则更新,如不存在则新建

# 请求 URL:

  • http://host:port/heycloud/api/base/notify

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
method email | webhook String - 通知的方法
parameters - Object - 通知选项的参数
├from - String - 发送者邮箱
├host - String - SMTP 地址
├password - String - SMTP 端口
├port - Number - 通知的方法
├secure - Boolean -
├to - String - 接收邮箱
├user - String - 邮箱用户名
└url - String - url

# 请求示例:

POST http://host:port/heycloud/api/base/notify

{
  "result": {
    "method": "email",
    "parameters": {...}
  }
}

# 正确响应示例:

{
  "result": {
    "id": "32c01298-ec72-4637-8dcd-cd190cfe5d32",
    "method": "webhook",
    "parameters": { "url": "" },
    "createdAt": "2021-03-12T03:18:00.333Z"
  }
}

# 错误响应示例:

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

# 测试通知选项

# 请求 URL:

  • http://host:port/heycloud/api/base/notify/test

# 请求方式:

  • POST

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
method email | webhook String - 通知的方法
parameters - Object - 通知选项的参数
├from - String - 发送者邮箱
├host - String - SMTP 地址
├password - String - SMTP 端口
├port - Number - 通知的方法
├secure - Boolean -
├to - String - 接收邮箱
├user - String - 邮箱用户名
└url - String - url

# 请求示例:

POST http://host:port/heycloud/api/base/notify/test

{
  "result": {
    "method": "email",
    "parameters": {...}
  }
}

# 正确响应示例:

{
  "result": {
    "method": "...",
    "notifiedAt": "xxxxxxx"
  }
}

# 错误响应示例:

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

# 禁用某种类型的通知选项

# 请求 URL:

  • http://host:port/heycloud/api/base/notify/:method

# 请求方式:

  • DELETE

# 请求 Header:

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

# 请求参数:

参数名称 可选值 类型 是否必须 默认值 说明
method email | webhook String - 通知的方法

# 请求示例:

DELETE http://host:port/heycloud/api/base/notify/email

{
  "result": {
    "method": "email",
    "parameters": {...}
  }
}

# 正确响应示例:

{
  "result": {
    "method": "...",
    "notifiedAt": "xxxxxxx"
  }
}

# 错误响应示例:

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