Update Space Members

Updates the Members of a Space.

MethodPUT
URLhttps://{subdomain}.kintone.com/k/v1/space/members.json
URL(guest space)https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/space/members.json
Authentication Password Authentication, Session Authentication
Content-Typeapplication/json

Contents

Permissions

  • Only the Space Administrators can use this API.

Request Parameters

Parameter Value Required Description
id Integer or String Yes The Space ID.
members Array Yes A list of members of the Space.
At least one Space Administrator must be specified.
Inactive and deleted users cannot be specified.
members[].entity Object Yes The entity information of the Space member.
Guest users cannot be specified.
members[].entity.type String Yes The entity type of the Space member.
  • USER: User
  • Group: Group
  • ORGANIZATION: Department
members[].entity.code String Yes The code of the entity.
members[].isAdmin Boolean or String Conditional The Space Administration settings of the user.
  • true: The member will be the Administrator of the Space.
  • false: The member will not be the Administrator of the Space.
    At least 1 Space Administrator is required to be set in the API call.
If ignored, this value is false.
members[].includeSubs Boolean or String The "Include Affiliated Departments" settings of the department.
  • true: Affiliated departments will be included.
  • false: Affiliated departments will not be included.
If ignored, this value is false.

Sample Request

JavaScript (using Kintone REST API Request)

 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
var body = {
  'id': '1001',
  '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.api(kintone.api.url('/k/v1/space/members.json', true), 'PUT', body, function(resp) {
  // success
  console.log(resp);
}, function(error) {
  // error
  console.log(error);
});

XMLHttpRequest

 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
var body = {
  'id': '1001',
  'members': [
    {
      'entity': {
        'type': 'USER',
        'code': 'user1'
      },
      'isAdmin': true
    },
    {
      'entity': {
        'type': 'GROUP',
        'code': 'group1'
      },
      'isAdmin': false
    },
    {
      'entity': {
        'type': 'ORGANIZATION',
        'code': 'org1'
      },
      'isAdmin': false,
      'includeSubs': true
    }
  ],
  // CSRF TOKEN: used for all APIs that have an HTTP method of POST, PUT and DELETE on Kintone.
  '__REQUEST_TOKEN__': kintone.getRequestToken()
};

var url = 'https://{subdomain}.kintone.com/k/v1/space/members.json';
var xhr = new XMLHttpRequest();
xhr.open('PUT', url);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function() {
  if (xhr.status === 200) {
    // success
    console.log(JSON.parse(xhr.responseText));
  } else {
    // error
    console.log(JSON.parse(xhr.responseText));
  }
};
xhr.send(JSON.stringify(body));

Response Parameters

An empty JSON object will be returned.

Sample Response

1
{}

Limitations

  • If the Space or Guest Space feature is turned off, an error will be returned.
  • This API cannot update Guest Members for Guest Spaces. To do this, use the Update Guest Members API.