更改欄位的設置

information

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

目錄

更改欄位的設置

更改欄位的設置。

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

URL

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

HTTP 方法

PUT

所需許可權

  • 應用程式管理

請求

參數

省略參數的設置不會更改。

參數名稱 必須 說明
app 數位或字串 必須 應用ID
properties 物件 必須 刪除欄位
properties.欄位代碼 物件 自選 每個欄位的設置
欄位代碼 指定更新前的域代碼。
如果要 properties.欄位代碼.code 更改域代碼,請在 中指定更新的域代碼。
properties.欄位代碼.type 字串 必須 欄位類型
  • CALC:計算
  • CATEGORY:類別
  • CHECK_BOX:核取方塊
  • CREATED_TIME:建立時間
  • CREATOR:建立人
  • DATE:日期
  • DATETIME:日期與時間
  • DROP_DOWN:下拉式選單
  • FILE:附件
  • GROUP:群組
  • GROUP_SELECT:選擇群組
  • LINK:連結
  • MODIFIER:更新人
  • MULTI_LINE_TEXT:多行文字方塊
  • MULTI_SELECT:複選
  • NUMBER:數值
  • ORGANIZATION_SELECT:選擇組織
  • RADIO_BUTTON:選項按鈕
  • RECORD_NUMBER:記錄號碼
  • REFEFENCE_TABLE:相關記錄清單
  • RICH_TEXT:文字編輯方塊
  • SINGLE_LINE:單行文字方塊
  • STATUS:更新流程管理的狀態
  • STATUS_ASSIGNEE:流程管理功能的工作人員
  • SUBTABLE:表格
  • TIME:時間
  • UPDATED_TIME:更新時間
  • USER_SELECT:選擇使用者
查找欄位指定從中複製該欄位的欄位類型。
properties.欄位代碼.code 字串 自選 欄位代碼
有關域代碼中可使用的字元的詳細資訊,請參閱 kintone説明 (External link)
properties.欄位代碼.label 字串 自選 欄位名稱
properties.欄位代碼.noLabel 布爾值或字串 自選 是否隱藏欄位名稱
  • true:隱藏
  • false:顯示
如果省略,則設置"false"。
properties.欄位代碼.required 布爾值或字串 自選 這是強制性的嗎?
  • true:命令的
  • false:任意
如果省略,則設置"false"。
properties.欄位代碼.unique 布爾值或字串 自選 是否禁止重複
  • true:值為唯一
  • false:允許重複
如果省略,則設置"false"。
properties.欄位代碼.maxValue 數位或字串 自選 最大值
properties.欄位代碼.minValue 數位或字串 自選 最小值
properties.欄位代碼.maxLength 數位或字串 自選 最大字元數
properties.欄位代碼.minLength 數位或字串 自選 最小字元數
properties.欄位代碼.defaultValue 字串或陣列 自選 預設值
對於可以具有多個初始值的欄位,請以數位格式指定它們。
defaultNowValue 如果指定,defaultNowValue 則設置的值。
對於使用者/組/組織選擇欄位,code type 指定帶有鍵和 .
properties.欄位代碼.defaultValue[].type 字串 條件必填項 使用者/組/組織選擇欄位的初始值類型
defaultValue 必需(如果指定)。
  • USER:使用者
  • GROUP:群組
  • ORGANIZATION:組織
  • FUNCTION:函數
properties.欄位代碼.defaultValue[].code 字串 條件必填項 使用者/組/組織選擇欄位的初始值代碼
defaultValue 必需(如果指定)。
  • 對於人員選取器欄位,可以指定以下值之一:
    • 使用者(登入名稱)
    • 群組代碼
    • 組織代碼
    • 函數名稱(LOGINUSER() 僅限)
    在訪客空間應用程式中,您只能指定使用者、組和函數名稱。
  • 對於組選擇欄位,您可以指定組代碼。
  • 對於組織選擇欄位,您可以指定以下值之一:
    • 組織代碼
    • 函數名稱(PRIMARY_ORGANIZATION() 僅限)
無法指定已刪除或處於非活動狀態的使用者/組/組織。
properties.欄位代碼.defaultNowValue 布爾值或字串 自選 將登記記錄時的日期和時間作為預設值
  • true:將登記記錄時的日期和時間作為預設值
  • false:將登記記錄時的日期和時間作為預設值
如果省略,則設置"false"。
properties.欄位代碼.options 物件 自選 設置選項
properties.欄位代碼.options.選択肢名 物件 自選 每個選項的設置
選択肢名 指定要在更新之前做出的選擇。
如果要添加新選項,請選択肢名 指定要添加到的選項的名稱。
如果要刪除現有選項,請不要使用要刪除的選項 選択肢名 的名稱指定屬性。
properties.欄位代碼.options.選択肢名.label 字串 自選 選項
如果要添加選項,請指定 選択肢名 與 相同的值。
properties.欄位代碼.options.選択肢名.index 數位或字串 條件必填項 選擇順序
選項按指定數位的升序排列。
options 如果指定,則為必填項。
properties.欄位代碼.align 字串 自選 對選項進行排序
  • HORIZONTAL:放下
  • VERTICAL:垂直
如果省略,則設置"HORIZONTAL"。
properties.欄位代碼.expression 字串 自選 自動計算
properties.欄位代碼.hideExpression 布爾值或字串 自選 是否隱藏計算欄位中的計算公式
  • true:隱藏
  • false:顯示
如果省略,則設置"false"。
properties.欄位代碼.digit 布爾值或字串 自選 是否顯示數位分隔符
  • true:顯示
  • false:不顯示
如果省略,則設置"false"。
properties.欄位代碼.thumbnailSize 數位或字串 自選 縮圖大小(以像素為單位 )
指定以下值之一:
  • 50
  • 150
  • 250
  • 500
properties.欄位代碼.protocol 字串 自選 連結類型
  • WEB:網站
  • CALL:電話號碼:
  • MAIL:電子郵件地址
properties.欄位代碼.format 字串 自選 計算欄位格式
  • NUMBER:數值(例:1000)
  • NUMBER_DIGIT:數值(例:1000)
  • DATEIME:日期與時間(例:2012-08-06 2:03)
  • DATE:日期(例:2012-08-06)
  • TIME:時間(例:2:03)
  • HOUR_MINUTE:小時分(例:26小時3分)
  • DAY_HOUR_MINUTE:天小時分(例:1天2小時3分)
如果省略,則設置"NUMBER"。
properties.欄位代碼.displayScale 數位或字串 自選 小數點後的顯示位數
properties.欄位代碼.unit 字串 自選 單位符號
properties.欄位代碼.unitPosition 字串 自選 單位符號的顯示位置
  • BEFORE:欄位前綴
  • AFTER:附在場地背面
如果省略,則設置"BEFORE"。
properties.欄位代碼.entities 陣列 自選 用戶選擇/組織選擇/組選擇欄位選擇
properties.欄位代碼.entities[].type 字串 條件必填項 選擇類型
entities 如果指定,則為必填項。
  • USER:使用者
  • GROUP:群組
  • ORGANIZATION:組織
properties.欄位代碼.entities[].code 字串 條件必填項 選擇代碼
entities 如果指定,則為必填項。
  • 對於人員選取器欄位,請指定以下值之一:
    • 使用者(登入名稱)
    • 群組代碼
    • 組織代碼
    在訪客空間應用程式中,您只能指定使用者或組。
  • 對於組選擇欄位,請指定組代碼。
  • 對於組織選擇欄位,指定組織代碼
無法指定已刪除或無效的使用者/組/組織代碼。
properties.欄位代碼.referenceTable 物件 自選 相關記錄清單的欄位
properties.欄位代碼.referenceTable.relatedApp 物件 自選 「引用的應用」設置
指定此屬性後,「相關記錄清單」欄位中的設置將初始化為「引用的應用」以外的設置。
properties.欄位代碼.referenceTable.relatedApp.app 數位或字串 條件必填項 要在「引用的應用」中指定的應用的應用ID
referenceTable 如果指定 或app code 是必需的。
如果兩者都指定code ,則設定值 。
properties.欄位代碼.referenceTable.relatedApp.code 字串 條件必填項 要在「引用的應用」中指定的應用代碼
referenceTable 如果指定 或app code 是必需的。
如果兩者都指定code ,則設定值 。
properties.欄位代碼.referenceTable.condition 物件 自選 設定要顯示的記錄
properties.欄位代碼.referenceTable.condition.field 字串 自選 在「顯示記錄的條件」 中指定的放置相關記錄清單欄位的應用程式的欄位代碼
properties.欄位代碼.referenceTable.condition.relatedField 字串 自選 在「顯示記錄的條件」 中指定的引用應用程式的欄位代碼
properties.欄位代碼.referenceTable.fliterCond 字串 自選 設定「進一步細化標準"
以查詢格式指定。有關查詢格式, 請參閱如何 編寫查詢。
properties.欄位代碼.referenceTable.displayFields 陣列 自選 在「要顯示的欄位」中指定的欄位的欄位代碼清單
properties.欄位代碼.referenceTable.sort 字串 自選 記錄排序
以查詢格式指定。有關查詢格式, 請參閱如何 編寫查詢。
properties.欄位代碼.referenceTable.size 數位或字串 自選 一次最多顯示記錄數
指定以下值之一:
  • 1
  • 3
  • 5
  • 10
  • 20
  • 30
  • 40
  • 50
如果省略,則設置為"5"。
properties.欄位代碼.lookup 物件 自選 Lookup欄位
properties.欄位代碼.lookup.fieldMappings 陣列 自選 複製其他欄位設定清單
properties.欄位代碼.lookup.fieldMappings.field 字串 條件必填項 要指定為「複製其他欄位**」目標**的欄位的欄位代碼
lookup.fieldMappings 如果指定,則為必填項。
properties.欄位代碼.lookup.fieldMappings.relatedField 字串 條件必填項 要指定為「複製其他欄位**」源**的欄位的欄位代碼
lookup.fieldMappings 如果指定,則為必填項。
properties.欄位代碼.lookup.lookupPickerFields 陣列 自選 "選擇原始記錄時要顯示的欄位"中指定的欄位代碼清單
properties.欄位代碼.lookup.filterCond 字串 自選 篩選的初始設定
以查詢格式指定。有關查詢格式, 請參閱如何 編寫查詢。
properties.欄位代碼.lookup.sort 字串 自選 排序的初始設定
以查詢格式指定。有關查詢格式, 請參閱如何 編寫查詢。
properties.欄位代碼.openGroup 布爾值或字串 自選 是否在組欄位中顯示欄位
  • true:顯示
  • false:隱藏
如果省略,則設置"false"。
properties.欄位代碼.fields 物件 自選 表中的欄位
對象properties 的結構與相同。
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
{
  "app": 1,
  "revision": 2,
  "properties": {
    "單行文字方塊": {
      "type": "SINGLE_LINE_TEXT",
      "code": "字串",
      "label": "字串",
      "noLabel": false,
      "required": false,
      "minLength": "",
      "maxLength": "",
      "expression": "",
      "hideExpression": false,
      "unique": false,
      "defaultValue": ""
    },
    "文字編輯方塊": {
      "type": "RICH_TEXT",
      "code": "文字編輯方塊",
      "label": "文字編輯方塊",
      "noLabel": false,
      "required": false,
      "defaultValue": ""
    },
    "多行文字方塊": {
      "type": "MULTI_LINE_TEXT",
      "code": "多行文字方塊",
      "label": "多行文字方塊",
      "noLabel": false,
      "required": false,
      "defaultValue": ""
    },
    "數值": {
      "type": "NUMBER",
      "code": "數值",
      "label": "數值",
      "noLabel": false,
      "required": false,
      "minValue": "",
      "maxValue": "",
      "digit": false,
      "unique": false,
      "defaultValue": "",
      "displayScale": "",
      "unit": "",
      "unitPosition": "BEFORE"
    },
    "計算": {
      "type": "CALC",
      "code": "計算",
      "label": "計算",
      "noLabel": false,
      "required": false,
      "expression": "數值",
      "format": "NUMBER",
      "displayScale": "",
      "hideExpression": false,
      "unit": "",
      "unitPosition": "BEFORE"
    },
    "選項按鈕": {
      "type": "RADIO_BUTTON",
      "code": "選項按鈕",
      "label": "選項按鈕",
      "noLabel": false,
      "required": true,
      "options": {
        "sample1": {
          "label": "sample1",
          "index": "0"
        },
        "sample2": {
          "label": "sample2",
          "index": "1"
        }
      },
      "defaultValue": "sample1",
      "align": "HORIZONTAL"
    },
    "核取方塊": {
      "type": "CHECK_BOX",
      "code": "核取方塊",
      "label": "核取方塊",
      "noLabel": false,
      "required": false,
      "options": {
        "sample1": {
          "label": "sample1",
          "index": "0"
        },
        "sample2": {
          "label": "sample2",
          "index": "1"
        }
      },
      "defaultValue": [],
      "align": "HORIZONTAL"
    },
    "複選": {
      "type": "MULTI_SELECT",
      "code": "複選",
      "label": "複選",
      "noLabel": false,
      "required": false,
      "options": {
        "sample1": {
          "label": "sample1",
          "index": "0"
        },
        "sample2": {
          "label": "sample2",
          "index": "1"
        },
        "sample3": {
          "label": "sample3",
          "index": "2"
        },
        "sample4": {
          "label": "sample4",
          "index": "3"
        }
      },
      "defaultValue": []
    },
    "下拉式選單": {
      "type": "DROP_DOWN",
      "code": "下拉式選單",
      "label": "下拉式選單",
      "noLabel": false,
      "required": false,
      "options": {
        "sample1": {
          "label": "sample1",
          "index": "0"
        },
        "sample2": {
          "label": "sample2",
          "index": "1"
        }
      },
      "defaultValue": ""
    },
    "日期": {
      "type": "DATE",
      "code": "日期",
      "label": "日期",
      "noLabel": false,
      "required": false,
      "unique": false,
      "defaultValue": "",
      "defaultNowValue": true
    },
    "時間": {
      "type": "TIME",
      "code": "時間",
      "label": "時刻",
      "noLabel": false,
      "required": false,
      "defaultValue": "",
      "defaultNowValue": true
    },
    "日期與時間": {
      "type": "DATETIME",
      "code": "日期與時間",
      "label": "日期與時間",
      "noLabel": false,
      "required": false,
      "unique": false,
      "defaultValue": "",
      "defaultNowValue": true
    },
    "附件": {
      "type": "FILE",
      "code": "附件",
      "label": "附件",
      "noLabel": false,
      "required": false,
      "thumbnailSize": "150"
    },
    "連結": {
      "type": "LINK",
      "code": "連結",
      "label": "連結",
      "noLabel": false,
      "required": false,
      "protocol": "WEB",
      "minLength": "",
      "maxLength": "",
      "unique": false,
      "defaultValue": ""
    },
    "選擇使用者": {
      "type": "USER_SELECT",
      "code": "選擇使用者",
      "label": "選擇使用者",
      "noLabel": false,
      "required": false,
      "entities": [],
      "defaultValue": []
    },
    "選擇組織": {
      "type": "ORGANIZATION_SELECT",
      "code": "選擇組織",
      "label": "選擇組織",
      "noLabel": false,
      "required": false,
      "entities": [],
      "defaultValue": []
    },
    "選擇群組": {
      "type": "GROUP_SELECT",
      "code": "選擇群組",
      "label": "選擇群組",
      "noLabel": false,
      "required": false,
      "entities": [],
      "defaultValue": []
    },
    "相關記錄清單": {
      "type": "REFERENCE_TABLE",
      "code": "相關記錄清單",
      "label": "相關記錄清單",
      "noLabel": false,
      "referenceTable": {
        "relatedApp": {
          "app": "2",
          "code": ""
        },
        "condition": {
          "field": "記錄號碼",
          "relatedField": "數值",
        },
        "filterCond": "",
        "displayFields": "單行文字方塊",
        "sort": "記錄編號 desc"
        "size": "5"
      }
    },
    "Lookup": {
      "type": "NUMBER",
      "code": "Lookup",
      "label": "Lookup",
      "noLabel": false,
      "required": false,
      "lookup": {
        "relatedApp": {
          "app": "2",
          "code": ""
        },
        "relatedKeyField": "記錄號碼",
        "fieldMappings": [
          {
            "field": "選擇使用者",
            "relatedField": "建立人",
          }
        ],
        "lookupPickerFields": [],
        "filterCond": "",
        "sort": "記錄編號描述"
      }
    },
    "群組": {
      "type": "GROUP",
      "code": "群組",
      "label": "群組",
      "noLabel": false,
      "openGroup": false
    },
    "表格": {
      "type": "SUBTABLE",
      "code": "表格",
      "label": "表格",
      "noLabel": false,
      "fields": {
        "單行文字方塊": {
          "type": "SINGLE_LINE_TEXT",
          "code": "字串",
          "label": "單行文字方塊",
          "noLabel": false,
          "required": false,
          "minLength": "",
          "maxLength": "",
          "expression": "",
          "hideExpression": false,
          "unique": false,
          "defaultValue": ""
        }
      }
    }
  }
}

回應

財產
屬性名稱 說明
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
curl -X PUT 'https://sample.cybozu.com/k/v1/preview/app/form/fields.json' \
  -H 'X-Cybozu-API-Token: API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1,
    "revision": 2,
    "properties": {
      "單行文字方塊": {
        "type": "SINGLE_LINE_TEXT",
        "code": "單行文字方塊",
        "label": "字串",
        "noLabel": false,
        "required": false,
        "minLength": "",
        "maxLength": "",
        "expression": "",
        "hideExpression": false,
        "unique": false,
        "defaultValue": ""
      }
    }
  }'
發送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
const body = {
  app: kintone.app.getId(),
  revision: 2,
  properties: {
    單行文字方塊: {
      type: 'SINGLE_LINE_TEXT',
      code: '單行文字方塊',
      label: '字串',
      noLabel: false,
      required: false,
      minLength: '',
      maxLength: '',
      expression: '',
      hideExpression: false,
      unique: false,
      defaultValue: '',
    }
  }
};

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

限制

以下欄位無法變更:

  • 狀態
  • 執行者
  • 類別