更改應用的狀況通知設置

information

本頁面使用機器翻譯而成。
機器翻譯免責聲明 (External link)

目錄

更改應用的狀況通知設置

打開應用程式的設定進行變更。

此 API 在測試環境中修改應用。
如果要將更改傳播到生產環境,請運行此 API,然後 運行將應用設置傳播到生產環境的 API

URL

常規應用
https://sample.cybozu.com/k/v1/preview/app/notifications/general.json
建立訪客空間
https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/preview/app/notifications/general.json

HTTP 方法

PUT

所需許可權

  • 應用程式管理

請求

參數
參數名稱 必須 說明
app 數位或字串 必須 應用ID
notifications 陣列 自選 應用條件通知設置清單
添加或更新通知設置時,請在 中指定現有通知設置 notifications[].entity 。未指定的通知設置將被刪除。
如果要刪除所有通知設置,請指定一個空陣列。
notifications 如果省略,則不更改。
notifications[].entity 物件 條件必填項 以條件通知設置為準
notifications 如果指定,則為必填項。
notifications[].entity.type 字串 條件必填項 條件通知設置的類型
  • USER:使用者
  • GROUP:群組
  • ORGANIZATION:組織
  • FIELD_ENTITY:要指定為"添加表單欄位"的欄位
entity 如果指定,則為必填項。
notifications[].entity.code 字串 條件必填項 設置條件通知的代碼
entity.type 這取決於的值。
  • 對於"USER":登錄名
  • 對於"GROUP":組代碼
  • 對於"ORGANIZATION":組織代碼
  • 對於FIELD_ENTITY:指定以下欄位的網域代碼:
    • 建立人
    • 更新人
    • 選擇使用者
    • 選擇組織
    • 選擇群組
entity 如果指定了參數,則為必填項。
如果要指定來賓使用者,請在登錄名前加上"guest/"。
notifications[].includeSubs 布爾值或字串 自選 設置是否由子單位繼承
  • true:繼承
  • false:不繼承
entity.type 是"ORGANIZATION"或"FIELD_ENTITY"是指定組織選擇欄位的唯一選項。
如果省略,則設置"false"。
notifications[].recordAdded 布爾值或字串 自選 添加記錄時是否通知
  • true:添加記錄時通知
  • false:添加記錄時不通知
如果省略,則設置"false"。
notifications[].recordEdited 布爾值或字串 自選 編輯記錄時是否通知
  • true:通過記錄編輯通知
  • false:編輯記錄時不通知
如果省略,則設置"false"。
notifications[].commentAdded 布爾值或字串 自選 是否在撰寫評論時通知
  • true:通過寫評論通知
  • false:寫評論時不通知
如果省略,則設置"false"。
notifications[].statusChanged 布爾值或字串 自選 是否希望收到狀態更新的通知
  • true:通知我狀態更新
  • false:不通知我狀態更新
如果省略,則設置"false"。
notifications[].fileImported 布爾值或字串 自選 載入檔時是否通知
  • true:通過載入檔通知
  • false:載入檔時不通知
如果省略,則設置"false"。
notifyToCommenter 布爾值或字串 自選 曾填寫回覆的使用者,將於該記錄新增回覆時收到通知。
  • true:在撰寫評論時接收通知
  • false:在撰寫評論時不接收通知
如果省略,則不會更改。
revision 數位或字串 自選 預期修訂號
如果與實際修訂號不匹配,則會發生錯誤,並且不會更改設置。
如果指定值"-1"或未指定值,則不會驗證修訂號。
示例請求
頁眉
1
2
3
4
{
  "X-Cybozu-API-Token": "API_TOKEN",
  "Content-Type": "application/json"
}
身體
 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
{
  "app": "1",
  "notifications": [
    {
      "entity": {
        "type": "USER",
        "code": "user1"
      },
      "recordAdded": true,
      "recordEdited": true,
      "commentAdded": false,
      "statusChanged": false,
      "fileImported": true
    },
    {
      "entity": {
        "type": "ORGANIZATION",
        "code": "org1"
      },
      "includeSubs": false,
      "recordAdded": true,
      "recordEdited": true,
      "commentAdded": false,
      "statusChanged": false,
      "fileImported": true
    }
  ],
  "notifyToCommenter": 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
33
34
curl -X PUT 'https://sample.cybozu.com/k/v1/preview/app/notifications/general.json' \
  -H 'X-Cybozu-API-Token: API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1,
    "notifications": [
      {
        "entity": {
          "type": "USER",
          "code": "user1"
        },
        "recordAdded": true,
        "recordEdited": true,
        "commentAdded": false,
        "statusChanged": false,
        "fileImported": true
      },
      {
        "entity": {
          "type": "ORGANIZATION",
          "code": "org1"
        },
        "includeSubs": false,
        "recordAdded": true,
        "recordEdited": true,
        "commentAdded": false,
        "statusChanged": false,
        "fileImported": true
      }
    ],
    "notifyToCommenter": true,
    "revision": "2",
    "__REQUEST_TOKEN__": kintone.getRequestToken()
  }'
發送kintone REST API請求 使用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
32
const body = {
  app: kintone.app.getId(),
  notifications: [
    {
      entity: {
        type: 'USER',
        code: 'user1'
      },
      recordAdded: true,
      recordEdited: true,
      commentAdded: false,
      statusChanged: false,
      fileImported: true
    },
    {
      entity: {
        type: 'ORGANIZATION',
        code: 'org1'
      },
      includeSubs: true,
      recordAdded: true,
      recordEdited: true,
      commentAdded: false,
      statusChanged: false,
      fileImported: true
    }
  ],
  notifyToCommenter: true,
  revision: '2'
};

await kintone.api(kintone.api.url('/k/v1/preview/app/notifications/general.json', true), 'PUT', body);