變更應用程式的設定

information

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

目錄

更改應用的圖表設置

打開應用程式的設定進行變更。
如果您的應用中存在同名圖表,或者更新后的圖表名稱與其他圖表名稱重複,則在運行此 API 時將出現錯誤。

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

URL

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

HTTP 方法

PUT

所需許可權

  • 應用程式管理

請求

參數
參數名稱 必須 說明
app 數位或字串 必須 應用ID
reports 物件 必須 圖形資訊
添加或更新圖形時,請在 reports 中指定現有圖形。否則,圖表將被刪除。
reports.圖形名稱 物件 自選 每個圖表的設置
  • 新增圖表時:
    指定要添加到的圖形的名稱 圖形名稱
  • 變更圖表時:
    在更新為 圖形名稱 之前指定圖形的名稱。
  • 移除圖表時:
    不指定要刪除的圖表名稱的屬性。
reports.圖形名稱.chartType 字串 條件必填項 圖表類型
指定以下值之一:
  • BAR:橫條圖
  • COLUMN:直條圖
  • PIE:圓形圖
  • LINE:折線圖
  • PIVOT_TABLE:交叉資料表
  • TABLE:表
  • AREA:面積圖
  • SPLINE:曲線圖
  • SPLINE_AREA:曲面圖
圖形名稱 如果指定,則為必填項。
reports.圖形名稱.chartMode 字串 條件必填項 圖形顯示模式
指定以下值之一:
  • NORMAL
    • chartType 如果是"BAR"或"COLUMN",則將
    • chartType 如果是"AREA"或"SPLINE_AREA":不堆疊
  • STACKED:堆疊
  • PERCENTAGE:百分比堆疊
chartType 當為 "BAR"、"COLUMN"、"AREA" 或 "SPLINE_AREA" 時是必需的。
reports.圖形名稱.name 字串 條件必填項 新圖表名稱
最多指定 64 個字元。
如果要添加圖表,則為必填項,請指定圖形名稱 與 相同的值。
reports.圖形名稱.index 數位或字串 條件必填項 圖形排序順序
它按升序排序。
圖形名稱 如果指定,則為必填項。
重複值會導致錯誤。
reports.圖形名稱.groups 陣列 條件必填項 要分類的項目清單
它們按您指定的順序設置為大、中、小專案。
如果要添加圖表,則為必填項。
您最多可以指定三個。
chartType 如果為"PIVOT_TABLE",則指定兩個或更多。
reports.圖形名稱.groups[].code 字串 條件必填項 要分類的物料的域代碼
groups 如果指定,則為必填項。
reports.圖形名稱.groups[].per 字串 條件必填項 要分類的項目的時間單位
指定以下值之一:
  • YEAR:以年為單位
  • QUARTER:以季度為單位
  • MONTH:以月為單位
  • WEEK:以週為單位
  • DAY:以日為單位
  • HOUR:以小時為單位
  • MINUTE:分鐘單位
groups[].code 如果在 中指定以下欄位,則為必填項。
  • 建立時間
  • 更新時間
  • 日期與時間
  • 日期:僅適用於"YEAR"、"QUARTER"、"MONTH"、"WEEK"和"DAY"
  • 時間:僅適用於"小時"和"分鐘"
groups[].code 可設置的值因 中指定的欄位而異。
reports.圖形名稱.aggregations 陣列 條件必填項 聚合方法清單
您最多可以指定 10 個。
chartType 如果是"PIVOT_TABLE",則只有一個。
如果要添加圖表,則為必填項。
reports.圖形名稱.aggregations[].type 字串 條件必填項 聚合方法的類型
指定以下值之一:
  • COUNT:記錄數
  • SUM:合計
  • AVERAGE:平均
  • MAX:最大
  • MIN:最小
aggregations 如果指定,則為必填項。
reports.圖形名稱.aggregations[].code 字串 條件必填項 要聚合的域代碼
aggregations[].type 如果為「SUM」或「AVERAGE」,則可以指定以下欄位:
  • 數值
  • 計算(數位)
  • 計算(小時)
    chartType 僅當「TABLE」是
  • 數位查找
aggregations[].type 如果為「MAX」或「MIN」,則可以指定以下欄位:
  • 數值
  • 計算(數位)
  • 計算(日期和時間、日期、時間、時間)
    chartType 僅當「TABLE」是
  • 日期與時間
    chartType 僅當「TABLE」是
  • 日期
    chartType 僅當「TABLE」是
  • 時間
    chartType 僅當「TABLE」是
  • 建立時間
    chartType 僅當「TABLE」是
  • 更新時間
    chartType 僅當「TABLE」是
  • 數位查找
aggregations[].type 如果不是"COUNT",則為必填項。
reports.圖形名稱.filterCond 字串 篩選條件
以查詢格式指定。有關查詢格式, 請參閱如何 編寫查詢。
如果在添加圖表時省略,則與指定"所有記錄"相同。
如果在更新時省略,則不會更改設置。
如果指定了已刪除的使用者/組織/組,則返回錯誤。
reports.圖形名稱.sorts 陣列 條件必填項 排序列表
您最多可以指定三個。
如果要添加圖表,則為必填項。
reports.圖形名稱.sorts[].by 字串 條件必填項 排序方式
指定以下值之一:
  • TOTAL:匯總值
  • GROUP1:大項目
  • GROUP2:中項目
  • GROUP3:小項目
sorts 如果指定,則為必填項。
reports.圖形名稱.sorts[].order 字串 條件必填項 排序順序
指定以下值之一:
  • ASC:遞增
  • DESC:遞減
sorts 如果指定,則為必填項。
reports.圖形名稱.periodicReport 物件 自選 設置定期報告
設定計劃報告時,您只能更改以下參數:
  • reports.圖形名稱.name
  • reports.圖形名稱.index
  • reports.圖形名稱.periodicReport.active
如果在更新時省略,則不會更改設置。
reports.圖形名稱.periodicReport.active 布爾值或字串 自選 定期報告的執行情況
指定以下值之一:
  • true:執行中
  • false:停用中
如果在首次設置計劃報告時省略,則將其設置為「true」。
如果在更新時省略,則不會更改設置。
reports.圖形名稱.periodicReport.period 物件 條件必填項 定期報告的聚合間隔
首次設置計劃報告時需要。
更新計劃報告時,請指定與現在相同的設置,或省略這些設置。
reports.圖形名稱.periodicReport.period.every 字串 條件必填項 定期報告的聚合間隔類型
指定以下值之一:
  • YEAR:每年
  • QUARTER:每季度
  • MONTH:每月
  • WEEK:每週
  • DAY:每天
  • HOUR:每小時
periodicReport.period 如果指定,則為必填項。
reports.圖形名稱.periodicReport.period.month 數位或字串 條件必填項 執行聚合的月份
指定一個介於 1 和 12 之間的整數。
periodicReport.period.every 如果為"YEAR",則為必填項。
reports.圖形名稱.periodicReport.period.time 字串 條件必填項 一天中要執行聚合的時間
格式為「HH:mm」格式。
periodicReport.period.every 如果為 "YEAR"、"QUARTER"、"MONTH"、"WEEK" 或 "DAY",則為必填項。
reports.圖形名稱.periodicReport.period.pattern 字串 條件必填項 執行季度匯總的月份
指定以下值之一:
  • JAN_APR_JUL_OCT:1 月、4 月、7 月、10 月
  • FEB_MAY_AUG_NOV:2 月、5 月、8 月、11 月
  • MAR_JUN_SEP_DEC:3 月、6 月、9 月、12 月
periodicReport.period.every 如果為"QUARTER",則為必填項。
reports.圖形名稱.periodicReport.period.dayOfMonth 字串 條件必填項 聚合日期
指定以下值之一:
  • 介於 1 和 31 之間的整數
  • 月底
    periodicReport.period.every 什麼時候是"QUARTER"或"MONTH"
periodicReport.period.every 如果為"YEAR"、"QUARTER"或"MONTH",則為必填項。
reports.圖形名稱.periodicReport.period.dayOfWeek 字串 條件必填項 要進行聚合的星期幾
指定以下值之一:
  • SUNDAY
  • MONDAY
  • TUESDAY
  • WEDNESDAY
  • THURSDAY
  • FRIDAY
  • SATURDAY
periodicReport.period.every 如果為"WEEK",則為必填項。
reports.圖形名稱.periodicReport.period.minute 數位或字串 條件必填項 執行聚合的分鐘數
指定以下值之一:
  • 0
  • 10
  • 20
  • 30
  • 40
  • 50
periodicReport.period.every 如果為"HOUR",則為必填項
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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
  "app": "1",
  "reports": {
    "初始設定": {
      "chartType": "BAR",
      "chartMode": "NORMAL",
      "name": "初始設定",
      "index": "0",
      "groups": [
        {
          "code": "選項按鈕",
        }
      ],
      "aggregations": [
        {
          "type": "COUNT"
        }
      ],
      "filterCond": "",
      "sorts": [
        {
          "by": "TOTAL",
          "order": "DESC"
        }
      ],
      "periodicReport": null
    },
    "各種圖形設置" {
      "chartType": "TABLE",
      "name": "各種圖形設置",
      "index": "1",
      "groups": [
        {
          "code": "選項按鈕",
        },
        {
          "code": "建立時間",
          "per": "YEAR"
        },
        {
          "code": "時刻",
          "per": "MINUTE"
        }
      ],
      "aggregations": [
        {
          "type": "COUNT"
        },
        {
          "type": "SUM",
          "code": "數值",
        },
        {
          "type": "AVERAGE",
          "code": "計算",
        },
        {
          "type": "MAX",
          "code": "建立時間",
        },
        {
          "type": "MIN",
          "code": "時刻"
        }
      ],
      "filterCond": "記錄編號 = \"1\" and 文字編輯方塊 like \"aaa\""
      "sorts": [
        {
          "by": "TOTAL",
          "order": "DESC"
        },
        {
          "by": "GROUP1",
          "order": "ASC"
        },
        {
          "by": "GROUP2",
          "order": "DESC"
        }
      ],
      "periodicReport": null
    },
    "定期報表": {
      "chartType": "BAR",
      "chartMode": "NORMAL",
      "name": "定期報表",
      "index": "2",
      "groups": [
        {
          "code": "選項按鈕"
        }
      ],
      "aggregations": [
        {
          "type": "COUNT"
        }
      ],
      "filterCond": "",
      "sorts": [
        {
          "by": "TOTAL",
          "order": "DESC"
        }
      ],
      "periodicReport": {
        "active": true,
        "period": {
          "every": "QUARTER",
          "pattern": "JAN_APR_JUL_OCT",
          "dayOfMonth": "END_OF_MONTH",
          "time": "23:30"
        }
      }
    }
  },
  "revision": "2"
}

回應

財產
屬性名稱 說明
revision 字串 更新後應用設置的修訂號
reports 物件 圖形資訊
reports.圖形名稱}.id 字串 圖形ID
示例回應
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "revision": "2",
  "reports": {
    "初始設定": {
      "id": "7319"
    },
    "各種圖形設置": {
      "id": "7321"
    },
    "定期報表": {
      "id": "7323"
    }
  }
}

示例代碼

使用 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
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
curl -X PUT 'https://sample.cybozu.com/k/v1/preview/app/reports.json' \
  -H 'X-Cybozu-API-Token: API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": "1",
    "reports": {
      "初始設定": {
        "chartType": "BAR",
        "chartMode": "NORMAL",
        "name": "初始設定",
        "index": "0",
        "groups": [
          {
            "code": "選項按鈕"
          }
        ],
        "aggregations": [
          {
            "type": "COUNT"
          }
        ],
        "filterCond": "",
        "sorts": [
          {
            "by": "TOTAL",
            "order": "DESC"
          }
        ],
        "periodicReport": null
      },
      "各種圖形設置": {
        "chartType": "TABLE",
        "name": "各種圖形設置",
        "index": "1",
        "groups": [
          {
            "code": "選項按鈕"
          },
          {
            "code": "建立時間",
            "per": "YEAR"
          },
          {
            "code": "時刻",
            "per": "MINUTE"
          },
          {
            "code": "建立時間"
            "per": "YEAR"
          },
          {
            "code": "時刻",
            "per": "MINUTE"
          }
        ],
        "aggregations": [
          {
            "type": "COUNT"
          },
          {
            "type": "SUM",
            "code": "數值"
          },
          {
            "type": "AVERAGE",
            "code": "計算"
          },
          {
            "type": "MAX",
            "code": "建立時間"
          },
          {
            "type": "MIN",
            "code": "時刻"
          }
        ],
        "filterCond": "記錄編號 = \"1\" and 文字編輯方塊 like \"aaa\"",
        "sorts": [
          {
            "by": "TOTAL",
            "order": "DESC"
          },
          {
            "by": "GROUP1",
            "order": "ASC"
          },
          {
            "by": "GROUP2",
            "order": "DESC"
          }
        ],
        "periodicReport": null
      },
      "定期報表": {
        "chartType": "BAR",
        "chartMode": "NORMAL",
        "name": "定期報表",
        "index": "2",
        "groups": [
          {
            "code": "選項按鈕"
          }
        ],
        "aggregations": [
          {
            "type": "COUNT"
          }
        ],
        "filterCond": "",
        "sorts": [
          {
            "by": "TOTAL",
            "order": "DESC"
          }
        ],
        "periodicReport": {
          "active": true,
          "period": {
            "every": "QUARTER",
            "pattern": "JAN_APR_JUL_OCT",
            "dayOfMonth": "END_OF_MONTH",
            "time": "23:30"
          }
        }
      }
    },
    "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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
const body = {
  app: 1,
  reports: {
    初始設定: {
      chartType: 'BAR',
      chartMode: 'NORMAL',
      name: '初始設定',
      index: '4',
      groups: [
        {
          code: '選項按鈕',
        }
      ],
      aggregations: [
        {
          type: 'COUNT'
        }
      ],
      filterCond: '',
      sorts: [
        {
          by: 'TOTAL',
          order: 'DESC'
        }
      ],
      periodicReport: null
    },
    各種圖表設定: {
      chartType: 'TABLE',
      name: '各種圖形設置',
      index: '4',
      groups: [
        {
          code: '選項按鈕',
        },
        {
          code: '建立時間',
          per: 'YEAR'
        },
        {
          code: '時間',
          per: 'MINUTE'
        }
      ],
      aggregations: [
        {
          type: 'COUNT'
        },
        {
          type: 'SUM',
          code: '數值',
        },
        {
          type: 'AVERAGE',
          code: '計算',
        },
        {
          type: 'MAX',
          code: '建立時間',
        },
        {
          type: 'MIN',
          code: '時間',
        }
      ],
      filterCond: '記錄編號 = \'1\' and 文字編輯方塊 like \'aaa\'',
      sorts: [
        {
          by: 'TOTAL',
          order: 'DESC'
        },
        {
          by: 'GROUP1',
          order: 'ASC'
        },
        {
          by: 'GROUP2',
          order: 'DESC'
        }
      ],
      periodicReport: null
    },
    定期報表: {
      chartType: 'BAR',
      chartMode: 'NORMAL',
      name: '定期報表',
      index: '1',
      groups: [
        {
          code: '選項按鈕',
        }
      ],
      aggregations: [
        {
          type: 'COUNT'
        }
      ],
      filterCond: '',
      sorts: [
        {
          by: 'TOTAL',
          order: 'DESC'
        }
      ],
      periodicReport: {
        active: true,
        period: {
          every: 'QUARTER',
          pattern: 'JAN_APR_JUL_OCT',
          dayOfMonth: 'END_OF_MONTH',
          time: '1',
        }
      }
    }
  },
  revision: '1',
};

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