更改記錄的條件通知的設置。
此 API 在測試環境中修改應用。
如果要將更改傳播到生產環境,請運行此 API,然後
運行將應用設置傳播到生產環境的 API 。
- 常規應用
- https://sample.cybozu.com/k/v1/preview/app/notifications/perRecord.json
- 建立訪客空間
- https://sample.cybozu.com/k/guest/
GUEST_SPACE_ID
/v1/preview/app/notifications/perRecord.json
PUT
參數
參數名稱 |
型 |
必須 |
說明 |
app |
數位或字串 |
必須 |
應用ID |
notifications |
陣列 |
自選 |
記錄的條件通知設置清單 添加或更新通知設置時,請在 中指定現有通知設置 notifications[].entity 。未指定的通知設置將被刪除。 如果要刪除所有通知設置,請指定一個空陣列。
notifications 如果省略,則不更改。 |
notifications[].filterCond |
字串 |
條件必填項 |
記錄的條件 以查詢格式指定。有關查詢格式,
請參閱如何 編寫查詢。
notifications 如果指定,則為必填項。如果省略,則包括所有記錄。 |
notifications[].title |
字串 |
自選 |
通知內容 如果省略,則設置空字元。 |
notifications[].targets |
陣列 |
條件必填項 |
通知的接收者
notifications 如果指定,則為必填項。 空陣列將刪除所有現有目標。 |
notifications[].targets[].entity |
物件 |
條件必填項 |
通知的接收者
targets 如果指定,則為必填項。 |
notifications[].targets[].entity.type |
字串 |
條件必填項 |
通知收件者的類型
USER :使用者GROUP :群組ORGANIZATION :組織FIELD_ENTITY :要指定為"添加表單欄位"的欄位
entity 如果指定,則為必填項。 |
notifications[].targets[].entity.code |
字串 |
條件必填項 |
通知目標目標的代碼
entity.type 這取決於的值。- 對於"使用者":用戶的登錄名
- 對於"GROUP":組代碼
- 對於"ORGANIZATION":組織代碼
- 對於FIELD_ENTITY:指定以下欄位的網域代碼:
如果您是訪客使用者,則您的登錄名前面有"guest/"。 |
notifications[].targets[].includeSubs |
布爾值或字串 |
自選 |
設置是否由子單位繼承如果省略,則設置"false"。
entity.type 是"ORGANIZATION"或"FIELD_ENTITY"是指定組織選擇欄位的唯一選項。 |
revision |
數位或字串 |
自選 |
預期修訂號 如果與實際修訂號不匹配,則會發生錯誤,並且不會更改設置。 如果指定值"-1"或未指定值,則不會驗證修訂號。 |
示例請求
頁眉
1
2
3
4
|
{
"X-Cybozu-API-Token": "API_TOKEN",
"Content-Type": "application/json"
}
|
關於請求頭,請參見
kintone REST API的通用規範 。
身體
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
{
"app": "1",
"notifications": [
{
"filterCond": "(\"user1\")中的用戶選擇字段",
"title": "使用者 1 已選擇",
"targets": [
{
"entity": {
"type": "USER",
"code": "user1"
}
}
]
},
{
"filterCond": "(\"org1\")中的組選擇字段",
"title": "已選擇",
"targets": [
{
"entity": {
"type": "ORGANIZATION",
"code": "org1"
},
"includeSubs": "true"
}
]
}
],
"revision": "2"
}
|
財產
屬性名稱 |
值類型 |
說明 |
revision |
字串 |
更改應用設置后的修訂號 |
示例回應
1
2
3
|
{
"revision": "2"
}
|
使用 curl 的請求
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
curl -X PUT 'https://sample.cybozu.com/k/v1/preview/app/notifications/perRecord.json' \
-H 'X-Cybozu-API-Token: API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"app": "1",
"notifications": [
{
"filterCond": "(\"user1\")中的用戶選擇字段",
"title": "使用者 1 已選擇",
"targets": [
{
"entity": {
"type": "USER",
"code": "user1"
}
],
},
{
"filterCond": "(\"org1\")中的組選擇字段",
"title": "已選擇",
"targets": [
{
"entity": {
"type": "ORGANIZATION",
"code": "org1"
},
"includeSubs": "true"
]
}
],
"revision": "2"
}'
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
const body = {
app: 1,
notifications: [
{
filterCond: '("org1")中的組選擇字段',
title: 'user1 已選擇',
targets: [
{
entity: {
type: 'USER',
code: 'user1'
}
}
]
},
{
filterCond: '("org1")中的組選擇字段',
title: '已選擇',
targets: [
{
entity: {
type: 'ORGANIZATION',
code: 'org1'
},
includeSubs: 'true'
}
]
}
],
revision: 4,
};
await kintone.api(kintone.api.url('/k/v1/preview/app/notifications/perRecord.json', true), 'PUT', body);
|