獲取 JavaScript/CSS 自定義項

information

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

目錄

獲取 JavaScript/CSS 自定義項

獲取應用的 JavaScript/CSS 自定義設置。

URL

獲取生產環境的設置時,URL 與獲取測試環境的設置時不同。

如果要獲取生產環境的設置
常規應用
https://sample.cybozu.com/k/v1/app/customize.json
建立訪客空間
https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/app/customize.json
獲取操作測試環境的設置
常規應用
https://sample.cybozu.com/k/v1/preview/app/customize.json
建立訪客空間
https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/preview/app/customize.json

HTTP 方法

GET

所需許可權

  • 應用程式管理

請求

參數
參數名稱 必須 說明
app 數位或字串 必須 應用ID
範例請求(如果要在網址中包含參數 )
URL

https://sample.cybozu.com/k/v1/app/customize.json?app=8

頁眉
1
2
3
{
  "X-Cybozu-Authorization": "QWRtaW5pc3RyYXRvcjpjeWJvenU="
}

關於請求頭,請參見 kintone REST API的通用規範

範例要求(如果要在要求正文中包含參數)
URL

https://sample.cybozu.com/k/v1/app/customize.json

頁眉
1
2
3
4
{
  "X-Cybozu-Authorization": "QWRtaW5pc3RyYXRvcjpjeWJvenU=",
  "Content-Type": "application/json"
}

關於請求頭,請參見 kintone REST API的通用規範

身體
1
2
3
{
  "app": "8"
}

回應

財產
屬性名稱 說明
scope 字串 定製範圍
  • ALL:所有使用者
  • ADMIN:僅限應用管理員
  • NONE:停用
desktop 物件 有關電腦上載入的檔案的資訊
desktop.js 陣列 JavaScript檔案
desktop.js[].type 字串 如何指定檔
  • URL:如果在URL 中指定
  • FILE:如果通過上傳指定
desktop.js[].url 字串 檔的 URL
desktop.js[].file 物件 附件資訊
desktop.js[].file.contentType 字串 MIME 類型
desktop.js[].file.fileKey 字串 檔鍵
desktop.js[].file.name 字串 檔案名稱
desktop.js[].file.size 字串 檔大小
單位為位元組。
desktop.css 陣列 CSS 檔案清單
desktop.css[].type 字串 如何指定檔
  • URL:如果在URL 中指定
  • FILE:如果通過上傳指定
desktop.css[].url 字串 檔的 URL
desktop.css[].file 物件 附件資訊
desktop.css[].file.contentType 字串 MIME 類型
desktop.css[].file.fileKey 字串 檔鍵
desktop.css[].file.name 字串 檔案名稱
desktop.css[].file.size 字串 檔大小
單位為位元組。
mobile 物件 有關在行動裝置上載入的檔案的資訊
mobile.js 陣列 JavaScript檔案
mobile.js[].type 字串 如何指定檔
  • URL:如果在URL 中指定
  • FILE:如果通過上傳指定
mobile.js[].url 字串 檔的 URL
mobile.js[].file 物件 附件資訊
mobile.js[].file.contentType 字串 MIME 類型
mobile.js[].file.fileKey 字串 檔鍵
mobile.js[].file.name 字串 檔案名稱
mobile.js[].file.size 字串 檔大小
單位為位元組。
mobile.css 陣列 CSS 檔案清單
mobile.css[].type 字串 如何指定檔
  • URL:如果在URL 中指定
  • FILE:如果通過上傳指定
mobile.css[].url 字串 檔的 URL
mobile.css[].file 物件 附件資訊
mobile.css[].file.contentType 字串 MIME 類型
mobile.css[].file.fileKey 字串 檔鍵
mobile.css[].file.name 字串 檔案名稱
mobile.css[].file.size 字串 檔大小
單位為位元組。
revision 字串 應用設置的修訂號
示例回應
 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
{
  "scope": "ALL",
  "desktop": {
    "js": [
      {
        "type": "URL",
        "url": "https://sample.com/example.js"
      },
      {
        "type": "FILE",
        "file": {
          "contentType": "application/javascript",
          "fileKey": "20150519023802B3EB762E870645F889B22F9D4F1F3059023",
          "name": "sample.js",
          "size": "12345"
        }
      }
    ],
    "css": []
  },
  "mobile": {
    "js": [
      {
        "type": "FILE",
        "file": {
          "contentType": "application/javascript",
          "fileKey": "20140823043800E9F53A742F7F4416B6E47234DBD6C0D4025",
          "name": "mobile.js",
          "size": "12345"
        }
      },
      {
        "type": "URL",
        "url": "https://sample.com/example-mobile.js"
      }
    ],
    "css": []
  },
  "revision": "15"
}

示例代碼

使用 curl 的請求
1
2
3
4
5
6
curl -X GET 'https://sample.cybozu.com/k/v1/app/customize.json' \
  -H 'X-Cybozu-Authorization: QWRtaW5pc3RyYXRvcjpjeWJvenU=' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1
  }'
發送kintone REST API請求 使用API發送請求
1
2
3
4
5
const body = {
  app: kintone.app.getId()
};

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

限制

  • 不能使用 API 令牌。