Add Space

Creates a Space from a Space template.

MethodPOST
URLhttps://{subdomain}.kintone.com/k/v1/template/space.json
Authentication Password Authentication , Session Authentication
Content-Typeapplication/json

Contents

Permissions

  • For creating Guest Spaces, the user will need to have permission to create Guest Spaces.

Request Parameters

Parameter Value Required Description
id Integer or String Yes The Space Template ID.
For instructions on creating Space Templates, refer to the following article:
Creating a Template from a Space (External link)
The Space Template ID is listed on the Space Templates list page, found under https://{domainname}.kintone.com/k/admin/system/spacetemplate/
name String Yes The new name of the Space.
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.
isPrivate Boolean or String The "Private" settings of the Space.
  • true: The Space will be Private.
  • false: The Space will not be Private.
If the isGuest parameter is set to true, this value is also true.
If ignored, this value is false.
isGuest Boolean or String The Guest Space settings of the Space.
  • true: The Space will be a Guest Space
  • false: The Space will be a normal Space.
If ignored, this value is false.
fixedMember Boolean or String The "Block users from joining or leaving the space and following or unfollowing the threads." settings of the Space.
  • true: Users will not be able to join/leave the Space or follow/unfollow threads.
  • false: Users will be able to join/leave the Space and follow/unfollow threads.
If ignored, this value is false.

Sample 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
36
var body = {
  'id': 1001,
  'name': 'Sample Space Name',
  '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/template/space.json', true), 'POST', 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
46
var body = {
  'id': 1001,
  'name': 'Sample Space Name',
  '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/template/space.json';
var xhr = new XMLHttpRequest();
xhr.open('POST', 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

Parameter Type Description
id String The Space ID of the created Space.

Sample Response

1
2
3
{
  "id": "1"
}

Limitations

  • If the Space or Guest Space feature is turned off, an error will be returned.