獲取kintone REST API的Schema資訊

information

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

目錄

獲取kintone REST API的Schema資訊

獲取指定kintone REST API的Schema資訊。
Schema資訊不適用於以下 API:

URL

https://sample.cybozu.com/k/v1/apis/API_ID.json

路徑參數
參數名稱 說明
API 的 ID 用於獲取Schema資訊的 API 的 ID
ID是apis獲取kintone REST API清單的金鑰名稱
獲取kintone REST API清單
例如,獲取單條記錄API (/k/v1/record.json[GET]),鍵名稱為「record/get」,URL 路徑為「https://sample.cybozu.com/k/v1/apis/record/get.json」。

HTTP 方法

GET

所需存取權限

不需要驗證資訊。

請求

參數

示例請求
URL

https://sample.cybozu.com/k/v1/apis/record/get.json

標頭

回應

即使禁用「空間」,「用戶」或「訪客空間」功能,您仍將獲得所有 API 的清單。

屬性名稱 值類型 內容
id 字串 kintone REST API通用規範
baseUrl 字串 用於執行 API 的基本 URL
path 字串 API 路徑
baseUrlpath是 API 的 URL。
httpMethod 字串 用於執行 API 的 HTTP 方法
request 物件 API 請求的Schema資訊
它以 JSON Schema表示。
response 物件 API 回應Schema資訊
它以 JSON Schema表示。
schemas 物件 API 中常用的 Schema 資訊清單
屬性名稱是表示Schema資訊的字串。
選擇JSON Schema的 $ref
示例回應
 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
{
  "id": "records/get",
  "baseUrl": "https://sample.cybozu.com/k/v1/",
  "path": "records.json",
  "httpMethod": "GET",
  "request": {
    "type": "object",
    "required": ["app"],
    "properties": {
      "app": {
        "type": "string",
        "format": "long"
      },
      "fields": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "query": {
        "type": "string",
        "format": "query"
      },
      "totalCount": {
        "format": "boolean",
        "type": "string"
      }
    }
  },
  "response": {
    "type": "object",
    "properties": {
      "records": {
        "type": "array",
        "items": {
          "type": "object",
          "patternProperties": {
            "*": {
              "anyOf": [
                { "$ref": "CalcSimpleValue" },
                { "$ref": "CategorySimpleValue" }
                // ...
              ],
              "type": "object"
            }
          }
        }
      },
      "totalCount": {
        "format": "long",
        "type": "string"
      }
    }
  },
  "schemas": {
    "SingleLineTextSimpleValue": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["CATEGORY", "CREATED_TIME"]
        },
        "value": { "type": "string" }
      }
    },
    "MultipleLineTextSimpleValue": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": ["CATEGORY", "CREATED_TIME"]
        },
        "value": { "type": "string" }
      }
    }
    // 縮寫
  }
}

關於 JSON Schema

上述請求、回應和架構中使用的 JSONSchema基於草稿 v4。
它使用core和validation,而不是hyper schema。

類型和格式

除了JSON Schema中定義的格式外,還定義了以下格式來表示kintone的參數限制。
kintone將來可能會添加自己的格式。

type format 說明
string long -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 範圍內的整數類型
string locale 「」、「en」、「ja」或「zh」的字符串
string boolean 「true」或「false」字符串
string email 電子郵件格式字串
string number 實實型
string query kintone查詢表示法
有關查詢格式的詳細資訊,請參閱以下頁面:
kintone API的查詢編寫基礎
string date-time ISO 格式的日期和時間字串
string timezone 指示時區的字串

獲取檔案 API 的架構

上傳檔案API

JSON Schema請求物件包含kintone內部類型資訊。
實際請求應以 multipart/form-data 格式發送。

下載檔案API

JSON Schema回應物件返回空。
實際請求下載檔案。

示例代碼

使用 curl 的請求
1
curl -X GET 'https://sample.cybozu.com/k/v1/apis/record/get.json
kintone.api()請求使用

有關詳細的kintone.api(),請參閱以下頁面。
發送kintone REST API請求

1
await kintone.api(kintone.api.url('/k/v1/apis/record/get.json'), 'GET', {});