獲取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": 8,
  }'
使用發送 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 權杖。