Update User's Groups

Updates information of Groups that a User belongs to.

MethodPUT
URLhttps://{subdomain}.kintone.com/v1/user/groups.json
Authentication Password Authentication, Session Authentication
Content-Typeapplication/json

Contents

Permissions

Only Administrators can use this API.

For more information on Administrators, refer to the following article:
Types of Administrators (External link)

Request Parameters

Parameter Value Required Description
code String Yes The User's log-in name.
Must be 128 characters or less. Empty strings, and characters consisting of only whitespaces are not allowed.
groups Array Yes An array of group codes to which the user belongs to.
Up to 1000 group codes can be specified.
If a user belongs to a group, but the group is not specified in the request, the user is removed from the group.
If the array is empty, the user is removed from all groups.
Dynamic groups cannot be specified.
For more information on Dynamic groups, refer to the Managing groups (roles) section of the following link:
Configuring Groups (Roles) (External link)

Sample Request

Update groups that user1 belongs, to group1 and group2.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
var body = {
  'code': 'user1',
  'groups': [
    'group1', 'group2'
  ]
};

kintone.api(kintone.api.url('/v1/user/groups.json', true), 'PUT', body, function(resp) {
  'use strict';
  // success
  console.log(resp);
}, function(error) {
  'use strict';
  // error
  console.log(error);
});

curl Sample

Update groups that user1 belongs, to group1 and group2.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ curl -X PUT \
  https://{subdomain}.kintone.com/v1/user/groups.json \
  -H 'Content-Type: application/json' \
  -H 'X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=' \
  -d '{
    'code': 'user1',
    'groups': [
      'group1', 'group2'
    ]
  }'

Response Parameters

An empty JSON object is returned.

Sample Response

1
{}

Limitations

  • It is not recommended run this API while performing the following operations on the Users & System Administration page:
    • Updates to users on the Departments & Users page
      For more information on Departments & Users, refer to the following article:
      Managing Users (External link)
    • Importing from a file