kintone API

選擇欄位

獲取欄位及其設置的清單。

目錄

HTTP 方法GET
URLhttps://sample.cybozu.com/k/v1/app/form/fields.json
URL(訪客空間)https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/app/form/fields.json
URL(操作測試環境)https://sample.cybozu.com/k/v1/preview/app/form/fields.json
URL(測試環境中的訪客空間)https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/preview/app/form/fields.json
認證 密碼驗證 , API令牌認證 , 會話認證
Content-Typeapplication/json(透過查詢字串指定查詢時不需要指定此項)

請求參數

參數名稱 類型 必須 說明
app 數值或字串 必須 應用ID
lang 字串 可省略 要選取的名稱的語言
如果為欄位或選項的名稱設置了多語言對應,請指定。
多語言對應 (External link)
  • ja:日文
  • en:英語
  • zh:中文
  • user:執行 API 的使用者設置為顯示語言的語言
    如果語言設置為「與網路瀏覽器設定相同」,則要獲取的語言取決於是否存在「Accept-Language」標頭。
    • 帶標題:帶標頭:「Accept-Language」標頭中指定的語言
    • 無標頭:在cybozu.com通用管理的地區設定中設置的語言
      地區設定 (External link)
  • default:預設
如果省略,則獲取預設名稱。

回應屬性

屬性名稱 類型 說明
properties 物件 欄位的設定
properties.欄位代碼 物件 每個欄位代碼的資訊
properties.欄位代碼.label 字串 欄位名稱
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:記錄號碼
  • REFERENCE_TABLE:相關記錄清單
  • RICH_TEXT:文字編輯方塊
  • SINGLE_LINE_TEXT:單行文字方塊
  • STATUS:更新流程管理的狀態
  • STATUS_ASSIGNEE: 流程管理功能的執行者
  • SUBTABLE:表格
  • TIME:時間
  • UPDATED_TIME:更新時間
  • USER_SELECT:選擇使用者
Lookup欄位的類型指定為與源欄位的欄位類型相同。
properties.欄位代碼.noLabel 布爾值 是否隱藏欄位名稱
  • true:不顯示
  • false:顯示
properties.欄位代碼.required 布爾值 是否強制性的嗎
  • true:必須
  • false:任意
properties.欄位代碼.unique 布爾值 是否禁止重複
  • true:禁止重複
  • false:允許重複
properties.欄位代碼.maxValue 字串 最大值
若為設定,則回傳空字串。
properties.欄位代碼.minValue 字串 最小值
若為設定,則回傳空字串。
properties.欄位代碼.maxLength 字串 最大字元數
若為設定,則回傳空字串。
properties.欄位代碼.minLength 字串 最小字元數
若為設定,則回傳空字串。
properties.欄位代碼.defaultValue 字串或陣列 預設值
對於允許多個初始值的欄位,將返回一個陣列。
properties.欄位代碼.defaultNowValue 布爾值 是否將記錄註冊時的日期和時間設置為初始值
  • true:將建立記錄時的日期和時間作為預設值
  • false:不要將記錄註冊時的日期和時間設置為預設值
properties.欄位代碼.options 物件 選項的設定
屬性.欄位代碼. options.(選項名稱).label 字串 選項名稱
屬性.欄位代碼. options.(選項名稱).index 字串 選項排序(遞增)
properties.欄位代碼.align 字串 對選項進行排序
  • HORIZONTAL:橫
  • VERTICAL:縱
properties.欄位代碼.expression 字串 自動計算
若為設定,則回傳空字串。
properties.欄位代碼.hideExpression 布爾值 是否隱藏計算欄位中的計算公式
  • true:不顯示
  • false:顯示
properties.欄位代碼.digit 布爾值 數值是否顯示千位分隔符
  • true:顯示千位元分隔符號
  • false:不顯示千位元分隔符號
properties.欄位代碼.thumbnailSize 字串 縮圖大小(畫素)
properties.欄位代碼.protocol 字串 連結類型
  • WEB:網站地址
  • CALL:電話號碼
  • MAIL:電子郵件地址
properties.欄位代碼.format 字串 計算欄位格式
  • NUMBER:數值(例:1000)
  • NUMBER_DIGIT:數值(例:1000)
  • DATETIME:日期與時間(例:2012-08-06 2:03)
  • DATE:日期(例:2012-08-06)
  • TIME:時間(例:2:03)
  • HOUR_MINUTE:小時分(例:26小時3分)
  • DAY_HOUR_MINUTE:天小時分(例:1天2小時3分)
properties.欄位代碼.displayScale 字串 小數點後的顯示位數
若為設定,則回傳空字串。
properties.欄位代碼.unit 字串 單位符號
properties.欄位代碼.unitPosition 字串 單位符號的顯示位置
  • BEFORE:欄位前
  • AFTER:附在場地背面
properties.欄位代碼.entities 陣列 選項中的使用者清單
若為設定,則回傳空字串。
properties.欄位代碼.entities[].code 字串 選項中的使用者的登入名,或者組或組織的代碼
properties.欄位代碼.entities[].type 字串 值的類型
  • USER:使用者
  • GROUP:群組
  • ORGANIZATION:組織
properties.欄位代碼.referenceTable 物件 相關記錄清單欄位的設置
如果引用的應用沒有查看記錄權限、添加記錄權限或管理應用的權限,則返回 null。
properties.欄位代碼.referenceTable.relatedApp 物件 「要參照的應用程式」設置
properties.欄位代碼.referenceTable.relatedApp.app 字串 「要參照的應用」中指定的應用的應用ID
properties.欄位代碼.referenceTable.relatedApp.code 字串 在「要參照的應用」 中指定的應用的應用代碼
若未設定應用程式代碼,則回傳一個空字串。
properties.欄位代碼.referenceTable.condition 物件 「要顯示的記錄條件」的設定
properties.欄位代碼.referenceTable.condition.field 字串 與「相關記錄」清單欄位位於同一應用程式中的欄位的域代碼,如「要顯示的記錄條件」部分中指定。
properties.欄位代碼.referenceTable.condition.relatedField 字串 「相關記錄」字段引用的應用字段的域代碼,如「要顯示的記錄的條件」中指定
properties.欄位代碼.referenceTable.filterCond 字串 「更多篩選條件」的設定
以查詢的形式返回。有關查詢格式的詳細資訊,請參閱以下頁面。
如何編寫查詢
properties.欄位代碼.referenceTable.displayFields 陣列 在「要顯示的欄位」中指定的欄位代碼清單
properties.欄位代碼.referenceTable.sort 字串 記錄排序
以查詢的形式返回。有關查詢格式的詳細資訊,請參閱以下頁面。
如何編寫查詢
properties.欄位代碼.referenceTable.size 字串 一次最多顯示記錄數
properties.欄位代碼.lookup 物件 Lookup欄位的設定
如果引用的應用沒有查看記錄權限、添加記錄權限或管理應用的權限,則返回 null。
properties.欄位代碼.lookup.relatedApp 物件 「要連結的應用程式」的設定
properties.欄位代碼.lookup.relatedApp.app 字串 連結的應用的應用ID
properties.欄位代碼.lookup.relatedApp.code 字串 連結的應用的應用代碼
若未設定應用程式代碼,則回傳一個空字串。
properties.欄位代碼.lookup.relatedKeyField 字串 「要複製的欄位」中指定的欄位的域代碼
properties.欄位代碼.lookup.fieldMappings 陣列 「其他要複製的欄位」中設定的清單
若為設定,則回傳空字串。
properties.欄位代碼.lookup.fieldMappings[].field 字串 在「其他要複製的欄位」中指定的複製目標欄位的欄位代碼
properties.欄位代碼.lookup.fieldMappings[].relatedField 字串 在「其他要複製的欄位」中指定的複製來源欄位的欄位代碼
properties.欄位代碼.lookup.lookupPickerFields 陣列 「要顯示在選取清單中的欄位」中設定的欄位代碼清單
若為設定,則回傳空字串。
properties.欄位代碼.lookup.filterCond 字串 篩選的初始設定
以查詢的形式返回。有關查詢格式的詳細資訊,請參閱以下頁面。
如何編寫查詢
properties.欄位代碼.lookup.sort 字串 排序的初始設定
以查詢的形式返回。有關查詢格式的詳細資訊,請參閱以下頁面。
如何編寫查詢
properties.欄位代碼.openGroup 布爾值 是否顯示群組內的欄位
  • true:顯示
  • false:不顯示
properties.欄位代碼.fields 物件 表格中的欄位
物件的結構與properties 相同。
properties.欄位代碼.enabled 布爾值 是否啟用該功能
此參數僅對狀態和類別欄位輸出。
  • 對於狀態欄位
    • true:啟用流程管理功能
    • false:禁用流程管理功能
  • 對於類別欄位
    • true:啟用類別功能
    • false:禁用類別功能
revision 字串 應用設置的修訂號

所需存取權限

取得正式環境的設定

您必須具有以下權限之一:

  • 應用程式中記錄的查看權限
  • 應用程式的記錄添加權限

取得操作測試環境的設定

  • 應用程式管理權限

範例

1
https\://sample.cybozu.com/k/v1/app/form/fields.json?app=8
1
2
3
{
  "X-Cybozu-API-Token": "API_TOKEN"
}

有關請求頭的詳細資訊,請參閱通用規格。
kintone REST API通用規格

1
https\://sample.cybozu.com/k/v1/app/form/fields.json
1
2
3
4
{
  "X-Cybozu-API-Token": "API_TOKEN",
  "Content-Type": "application/json"
}

有關請求頭的詳細資訊,請參閱通用規格。
kintone REST API通用規格

1
2
3
4
{
  "app": "8",
  "lang": "ja"
}

  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
{
  "properties": {
    "單行文字方塊_0" : {
      "type": "SINGLE_LINE_TEXT",
      "code": "單行文字方塊_0",
      "label": "單行文字方塊",
      "noLabel": false,
      "required": true,
      "unique": true,
      "maxLength": "64",
      "minLength": "0",
      "defaultValue": "",
      "expression": "",
      "hideExpression": false
    },
    "數值_0": {
      "type": "NUMBER",
      "code": "數值_0",
      "label": "數值",
      "noLabel": true,
      "required": false,
      "unique": false,
      "maxValue": "64",
      "minValue": "0",
      "defaultValue": "12345",
      "expression": "",
      "digit": true,
      "displayScale": "",
      "unit": "$",
      "unitPosition": "BEFORE"
    },
    "選項按鈕_0": {
      "type": "RADIO_BUTTON",
      "code": "選項按鈕_0",
      "label": "選項按鈕",
      "noLabel": false,
      "required": true,
      "defaultValue": "sample2",
      "options": {
        "sample1": {
          "label": "sample1",
          "index": "0"
        },
        "sample2": {
          "label": "sample2",
          "index": "1"
        },
        "sample3": {
          "label": "sample3",
          "index": "2"
        }
      },
      "align": "horizontal"
    },
    "核取方塊_0": {
      "type": "CHECK_BOX",
      "code": "核取方塊_0",
      "label": "核取方塊",
      "noLabel": false,
      "required": false,
      "defaultValue": ["sample1", "sample3"],
      "options": {
        "sample1": {
          "label": "sample1",
          "index": "0"
        },
        "sample2": {
          "label": "sample2",
          "index": "2"
        },
        "sample3": {
          "label": "sample3",
          "index": "1"
        }
      },
      "align": "horizontal"
    },
    "日期_0": {
      "type": "DATE",
      "code": "日期_0",
      "label": "日期",
      "noLabel": false,
      "required": false,
      "unique": true,
      "defaultValue": "",
      "defaultNowValue": true
    },
    "日期與時間_0": {
      "type": "DATETIME",
      "code": "日期與時間_0",
      "label": "日期與時間",
      "noLabel": false,
      "required": false,
      "unique": false,
      "defaultValue": "2012-07-19T00:00Z",
      "defaultNowValue": false
    },
    "附件_0": {
      "type": "FILE",
      "code": "附件_0",
      "label": "附件",
      "noLabel": true,
      "required": false,
      "thumbnailSize": "150"
    },
    "連結_0": {
      "type": "LINK",
      "code": "連結_0",
      "label": "連結",
      "noLabel": true,
      "required": false,
      "unique": false,
      "defaultValue": "https://example.com",
      "maxLength": "64",
      "minLength": "0",
      "protocol": "WEB"
    },
    "選擇使用者_0": {
      "type": "USER_SELECT",
      "code": "選擇使用者_0",
      "label": "選擇使用者",
      "noLabel": true,
      "required": false,
      "defaultValue": [
        {
          "code": "user1",
          "type": "USER"
        },
        {
          "code": "group1",
          "type": "GROUP"
        },
        {
          "code": "org1",
          "type": "ORGANIZATION"
        },
        {
          "code": "LOGINUSER()",
          "type": "FUNCTION"
        }
      ],
      "entities": [
        {
          "code": "user1",
          "type": "USER"
        },
        {
          "code": "group1",
          "type": "GROUP"
        }
      ]
    },
    "相關記錄清單_0": {
      "type": "REFERENCE_TABLE",
      "code": "相關記錄清單_0",
      "label": "相關記錄清單",
      "noLabel": true,
      "referenceTable": {
        "relatedApp": {
          "app": "3",
          "code": "要參照的應用"
        },
        "condition": {
          "field": "當前應用程式的欄位",
          "relatedField": "要參照的應用的欄位"
        },
        "filterCond": "數值_0 > 10 and 數值_1 > 20",
        "displayFields": ["要顯示的欄位_1","要顯示的欄位_2"]
        "sort": "數值_0 desc, 數值_1 asc",
        "size": "5"
      }
    },
    "Lookup": {
      "type": "SINGLE_LINE_TEXT",
      "code": "Lookup_0",
      "label": "Lookup",
      "noLabel": true,
      "required": false,
      "lookup": {
        "relatedApp": {
          "app": "100",
          "code": "源應用的應用代碼"
        },
        "relatedKeyField": "複製來源欄位",
        "fieldMappings": [
          {
            "field": "複製目標欄位",
            "relatedField": "複製來源欄位"
          }
        ],
        "lookupPickerFields": ["要顯示在選取清單中的欄位1"]
        "filterCond": "數值_0 > 10 and 數值_1 > 20",
        "sort": "數值_0 desc, 數值_1 asc"
      }
    },
    "群組_0": {
      "type": "GROUP",
      "code": "群組_0",
      "label": "群組",
      "noLabel": true,
      "openGroup": true
    },
    "表格_0": {
      "type": "SUBTABLE",
      "code": "表格_0",
      "label": "表格",
      "noLabel": false,
      "fields": {
        "單行文字方塊_表格": {
          "type": "SINGLE_LINE_TEXT",
          "code": "單行文字方塊_表格",
          "label": "單行文字方塊表格",
          "noLabel": false,
          "required": true,
          "unique": false,
          "maxLength": "64",
          "minLength": "0",
          "defaultValue": "",
          "expression": "",
          "hideExpression": false
        }
      }
    },
    "狀態": {
      "type": "STATUS",
      "code": "狀態",
      "label": "狀態",
      "enabled": "true"
    },
    "執行者" : {
      "type": "STATUS_ASSIGNEE",
      "code": "執行者",
      "label": "執行者",
      "enabled": "true"
    },
    "類別" : {
      "type": "CATEGORY",
      "code": "類別",
      "label": "類別",
      "enabled": "true"
    }
  },
  "revision": "2"
}

有關kintone.api()的說明,請參閱以下頁面。
傳送kintone REST API請求

1
2
3
4
5
6
const body = {
  app: kintone.app.getId(),
  lang: 'ja'
};

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

根據您的環境,curl的格式可能會有所不同。
有關說明,請參閱以下頁面。
使用curl命令執行kintone REST API/3.執行API

1
2
3
4
5
6
7
curl -X GET 'https://sample.cybozu.com/k/v1/app/form/fields.json' \
  -H 'X-Cybozu-API-Token: API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1,
    "lang": "ja"
  }'

補充