更改提醒條件通知的設置

information

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

目錄

更改提醒條件通知的設置

設置提醒的條件通知。

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

URL

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

HTTP 方法

PUT

所需許可權

  • 應用程式管理

請求

參數
參數名稱 必須 說明
app 數位或字串 必須 應用ID
notifications 陣列 自選 提醒條件通知設置清單
添加或更新通知設置時,請在 中指定現有通知設置 notifications[].entity 。未指定的通知設置將被刪除。
如果要刪除所有通知設置,請指定一個空陣列。
notifications 如果省略,則不更改。
notifications[].timing 物件 條件必填項 通知時間
notifications 如果指定,則為必填項。
notifications[].timing.code 字串 條件必填項 欄位的欄位代碼,該字段代碼將是通知時要設置的參考日期和時間
指定以下欄位的網域代碼:
  • 建立時間
  • 更新時間
  • 日期與時間
  • 日期
timing 如果指定,則為必填項。
notifications[].timing.daysLater 數位或字串 條件必填項 參考日期和時間之前或之後的多少天或幾天將收到通知?
指定一個介於 -10,000 和 10,000 之間的整數。
如果要在參考日期和時間之前收到通知,請指定負整數。
timing 如果指定,則為必填項。
notifications[].timing.hoursLater 數位或字串 條件必填項 從添加到基準日期和時間 timing.daysLater 的日期和時間中,應提前多少小時或小時通知?
指定一個介於 -10,000 和 10,000 之間的整數。
如果早於參考日期和時間,請指定負整數。
timing 如果timing.hoursLater timing.time 指定,則為 OR。
notifications[].timing.time 字串 條件必填項 從添加到基準日期和 timing.daysLater 時間的日期開始何時通知
格式為"HH:mm"(例如,09:20),並以 10 分鐘為增量指定。
timing 如果timing.hoursLater timing.time 指定,則為 OR。
notifications[].filterCond 字串 自選 設定通知條件(提醒)
以查詢格式設置。
有關查詢格式, 請參閱如何 編寫查詢。
省略值、指定空字串或"null"與指定"All Records"相同。
如果指定了已刪除的使用者、組織或組,則會發生錯誤。
如果指定條件中包含「order by」、「limit」和「offset」,則會發生錯誤。
notifications[].title 字串 通知內容
最多指定 100 個字元。
如果省略,則設置空字元。
notifications[].targets 陣列 條件必填項 通知收件人名單
notifications 如果指定,則為必填項。
notifications[].targets[].entity 物件 條件必填項 通知收件者的類型
targets 如果指定,則為必填項。
notifications[].targets[].entity.type 字串 條件必填項 條件通知目標的類型
entity 如果指定,則為必填項。
  • USER:使用者
  • GROUP:群組
  • ORGANIZATION:組織
  • FIELD_ENTITY:要指定為"添加表單欄位"的欄位
對於訪客空間,指定"ORGANIZATION"將導致錯誤。
notifications[].targets[].entity.code 字串 條件必填項 為其發出條件通知的代碼

entity.type 這取決於的值。
  • 對於"使用者":用戶的登錄名
  • 對於"GROUP":組代碼
  • 對於"ORGANIZATION":組織代碼
  • 對於FIELD_ENTITY:指定以下欄位的網域代碼:
    • 建立人
    • 更新人
    • 選擇使用者
    • 選擇組織
    • 選擇群組
如果您是訪客使用者,則您的登錄名前面有"guest/"。
entity 如果指定,則為必填項。
notifications[].targets[].includeSubs 布爾值或字串 自選 工作人員是否應包括子組織
  • true:包括
  • false:包括
如果省略,則設置"false"。
entity.type 僅當在組織選擇欄位中指定「ORGANIZATION」或「FIELD_ENTITY」時才指定。
否則,將忽略該設置。
timezone 字串 提醒時間的時區
請參閱時區的可能值 清單 (External link)
如果您從未保存過提醒條件通知,則省略該值將設置運行 API 的使用者的時區。
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
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  "app": 1,
  "notifications": [
    {
      "timing": {
        "code": "建立時間",
        "daysLater": "1",
        "hoursLater": "2"
      },
      "filterCond": "用戶選擇字段 in (\"user1\")",
      "title": "這是一個提醒",
      "targets": [
        {
          "entity": {
            "type": "USER",
            "code": "user1"
          },
          "includeSubs": false
        }
      ]
    },
    {
      "timing": {
        "code": "建立時間",
        "daysLater": "-3",
        "time": "08:30"
      },
      "filterCond": "用戶選擇字段 in (\"user1\")",
      "title": "這是一個提醒",
      "targets": [
        {
          "entity": {
            "type": "USER",
            "code": "user1"
          },
          "includeSubs": false
        }
      ]
    }
  ],
  "timezone": "Asia/Tokyo",
  "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
35
36
37
38
39
40
41
42
43
44
45
46
curl -X PUT 'https://sample.cybozu.com/k/v1/preview/app/notifications/reminder.json' \
  -H 'X-Cybozu-API-Token: API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1,
    "notifications": [
      {
        "timing": {
          "code": "建立時間",
          "daysLater": "1",
          "hoursLater": "2"
        },
        "filterCond": "用戶選擇字段 in (\"user1\")",
        "title": "這是一個提醒",
        "targets": [
          {
            "entity": {
              "type": "USER",
              "code": "user1"
            },
            "includeSubs": false
          }
        ]
      },
      {
        "timing": {
          "code": "建立時間",
          "daysLater": "-3",
          "time": "08:30"
        },
        "filterCond": "用戶選擇字段 in (\"user1\")",
        "title": "這是一個提醒",
        "targets": [
          {
            "entity": {
              "type": "USER",
              "code": "user1"
            },
            "includeSubs": false
          }
        ]
      }
    ],
    "timezone": "Asia/Tokyo",
    "revision": "2"
  }'
發送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
33
34
35
36
37
38
39
40
41
42
43
44
45
const body = {
  app: 1,
  notifications: [
    {
      timing: {
        code: '建立時間',
        daysLater: '1',
        hoursLater: '2'
      },
      filterCond: '用戶選擇字段 in (\'user1\')',
      title: '這是一個提醒',
      targets: [
        {
          entity: {
            type: 'USER',
            code: 'user1'
          },
          includeSubs: false
        }
      ]
    },
    {
      timing: {
        code: '建立時間',
        daysLater: '-3',
        time: '08:30'
      },
      filterCond: '用戶選擇字段 in (\'user1\')',
      title: '這是一個提醒',
      targets: [
        {
          entity: {
            type: 'USER',
            code: 'user1'
          },
          includeSubs: false
        }
      ]
    }
  ],
  timezone: 'Asia/Tokyo',
  revision: '2'
};

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