更新空間的成員

information

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

目錄

更新空間的成員

使用指定的內容更新空間成員和空間管理員的設置。

  • 如果不使用空格功能,則會發生錯誤。
  • 如果禁用了訪客空間功能,則在嘗試更新訪客空間時將發生錯誤。
  • 您無法更新訪客成員設置。

URL

正常空間
https://sample.cybozu.com/k/v1/space/members.json
訪客空間
https://sample.cybozu.com/k/guest/GUEST_SPACE_ID/v1/space/members.json

HTTP 方法

PUT

所需許可權

  • 空間管理

請求

參數
參數名稱 必須 說明
id 數位或字串 必須 要更新其成員信息的空間的空間ID
members 陣列 必須 取得空間成員的資訊
如果您沒有至少一個空間管理員,或者您指定了以下使用者之一,則會出現錯誤。
  • 不使用kintone的使用者
  • 停用中的使用者
  • 操作使用者
members[].entity 物件 必須 更新空間的成員
無法指定來賓成員。
members[].entity.type 字串 必須 更新空間的成員
您可以指定以下值:
  • USER
  • GROUP
  • ORGANIZATION
members[].entity.code 字串 必須 更新空間的成員
members[].isAdmin 布爾值或字串 條件必填項 是否將成員設為空間管理員
  • true:如果您想成為空間管理員
  • false:如果您不想成為空間管理員
如果省略,則設置"false"。
如果未指定至少一個空間管理員,則會收到錯誤。
members[].includeSubs 布爾值或字串 自選 是否包括子組織
  • true:如果要包含子組織
  • false:如果您不想包含子組織
entity.type 是"組織"。
如果省略,則設置"false"。
示例請求
頁眉
1
2
3
4
{
  "X-Cybozu-Authorization": "QWRtaW5pc3RyYXRvcjpjeWJvenU=",
  "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
{
  "id": 1,
  "members": [
    {
      "entity": {
        "type": "USER",
        "code": "user1"
      },
      "isAdmin": true
    },
    {
      "entity": {
        "type": "GROUP",
        "code": "group1"
      },
      "isAdmin": false
    },
    {
      "entity": {
        "type": "ORGANIZATION",
        "code": "org1"
      },
      "isAdmin": false,
      "includeSubs": true
    }
  ]
}

回應

1
{}

樣本

使用 curl 的請求
 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
curl -X PUT 'https://sample.cybozu.com/k/v1/space/members.json' \
  -H 'X-Cybozu-Authorization: QWRtaW5pc3RyYXRvcjpjeWJvenU=' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "1",
    "members": [
      {
        "entity": {
          "type": "USER",
          "code": "user1"
        },
        "isAdmin": "true"
      },
      {
        "entity": {
          "type": "GROUP",
          "code": "group1"
        },
        "isAdmin": "false"
      },
      {
        "entity": {
          "type": "ORGANIZATION",
          "code": "org1"
        },
        "isAdmin": "false",
        "includeSubs": "true"
      }
    ]
  }'
發送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
22
23
24
25
26
27
28
29
const body = {
  id: 1,
  members: [
    {
      entity: {
        type: 'USER',
        code: 'user1'
      },
      isAdmin: true
    },
    {
      entity: {
        type: 'GROUP',
        code: 'group1'
      },
      isAdmin: false
    },
    {
      entity: {
        type: 'ORGANIZATION',
        code: 'org1'
      },
      isAdmin: false,
      includeSubs: true
    }
  ]
};

await kintone.api(kintone.api.url('/k/v1/space/members.json', true), 'PUT', body);