通知
方法与权限
| API | GET | POST | PUT | PATCH | DELETE |
|---|---|---|---|---|---|
| 组织列表 | 用户 | 用户 | - | - | - |
| 组织详情 | 用户 | - | - | 用户 | 用户 |
获取通知列表
端点: /notifications/notification/list/{level}/{sid}/{serializer}/
获取通知列表。你只能看到发送给你的通知。
参数: level (路径, 字符串)
organization
参数: sid (路径, 字符串)
organization sid
参数: serializer (路径, 字符串)
list 或 detail
参数: `` (头部, 字符串)
响应: 200
# serializer = name
{
"page_size": 10,
"page_number": 1,
"page_count": 2,
"count": 12,
"next": null,
"previous": null,
"add_permission": true,
"results": [
{
"sid": "adgj0a40xb7chmrwBGL",
"name": "New version v5.0 released",
},
...
[
{
# serializer = list
{
"page_size": 10,
"page_number": 1,
"page_count": 2,
"count": 12,
"next": null,
"previous": null,
"add_permission": true,
"results": [
{
"sid": "adgj0a40xb7chmrwBGL",
"name": "New version v5.0 released",
"From": {
"sid": "Labii",
"name": "Labii"
},
"is_read": false,
"change_permission": true
},
...
[
{
# serializer = detail
{
"page_size": 10,
"page_number": 1,
"page_count": 2,
"count": 12,
"next": null,
"previous": null,
"add_permission": true,
"results": [
{
"sid": "ILOR0a40x5dKPUZ50ej",
"parent": null,
"From": {
"sid": "Labii",
"name": "Labii"
},
"name": "Filter digest for My experiments on 2021-03-14",
"body": "",
"rows": [
],
"is_read": true,
"updated_by": null,
"date_updated": "2021-03-14T20:57:37.077810Z",
"date_created": "2021-03-14T20:57:37.073960Z",
"change_permission": true
},
...
[
{
创建通知列表
端点: /notifications/notification/list/{level}/{sid}/{serializer}/
创建新通知
参数: level (路径, 字符串)
参数: sid (路径, 字符串)
参数: serializer (路径, 字符串)
参数: token (头部, 字符串)
参数: to (正文, 数组)
[{sid:"", name:""}], 接收通知的人员数组
参数: name (正文, 字符串)
参数: body (正文, 字符串)
通知消息
参数: parent (正文, 对象)
{sid:"", name:""} 的父通知
参数: should_email (正文, 布尔)
无论用户的电子邮件设置如何,是否发送电子邮件
响应: 201
{
"sid": "ILOR0a40x5dKPUZ50ej",
"parent": null,
"From": {
"sid": "Labii",
"name": "Labii"
},
"name": "Filter digest for My experiments on 2021-03-14",
"body": "",
"rows": [
],
"is_read": true,
"updated_by": null,
"date_updated": "2021-03-14T20:57:37.077810Z",
"date_created": "2021-03-14T20:57:37.073960Z",
"change_permission": true
}
响应: 406
Please select at least one person or team to receive this notification
获取通知详情
端点: /notifications/notification/detail/{sid}/
查看通知将使此通知 is_read=True。
参数: sid (路径, 字符串)
参数: token (头部, 字符串)
响应: 200
{
"sid": "ILOR0a40x5dKPUZ50ej",
"parent": null,
"From": {
"sid": "Labii",
"name": "Labii"
},
"name": "Filter digest for My experiments on 2021-03-14",
"body": "",
"rows": [
],
"is_read": true,
"updated_by": null,
"date_updated": "2021-03-14T20:57:37.077810Z",
"date_created": "2021-03-14T20:57:37.073960Z",
"change_permission": true
}
修补通知详情
端点: /notifications/notification/detail/{sid}/
参数: sid (路径, 字符串)
参数: token (头部, 字符串)
响应: 200
{
"sid": "ILOR0a40x5dKPUZ50ej",
"parent": null,
"From": {
"sid": "Labii",
"name": "Labii"
},
"name": "Filter digest for My experiments on 2021-03-14",
"body": "",
"rows": [
],
"is_read": true,
"updated_by": null,
"date_updated": "2021-03-14T20:57:37.077810Z",
"date_created": "2021-03-14T20:57:37.073960Z",
"change_permission": true
}
删除通知详情
端点: /notifications/notification/detail/{sid}/
参数: sid (路径, 字符串)
参数: token (头部, 字符串)
响应: 200 — 如果还有其他接收者。
{}
响应: 204 — 如果你是唯一的接收者。
{}