Get User's Groups

Gets information of Groups that a User belongs to.

MethodGET
URLhttps://{subdomain}.kintone.com/v1/user/groups.json
AuthenticationPassword Authentication
Content-Typeapplication/json (not needed if specifying the query with a query string)

Contents

Permissions

All users other than Guest Users can use this API.

Request Parameters

Parameter Value Required Description
code String Yes The User’s code (log-in name).

Sample Request

JavaScript (using Kintone REST API Request )

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var body = {
  'code': 'sample_user_code'
};
kintone.api(kintone.api.url('/v1/user/groups', true), 'GET', 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
var params = '?code=sample_user_code';
var url = 'https://{subdomain}.kintone.com/v1/user/groups.json' + params;
console.log(url);
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onload = function() {
  if (xhr.status === 200) {
    // success
    console.log(JSON.parse(xhr.responseText));
  } else {
    // error
    console.log(JSON.parse(xhr.responseText));
  }
};
xhr.send();

Response Parameters

Parameter Type Description
groups Array A list of Groups that the user belongs to, as group types .

Sample Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "groups": [
    {
      "id": "1",
      "code": "g1",
      "name": "Development Group",
      "description": ""
    },
    {
      "id": "7532782697181632513",
      "code": "everyone",
      "name": "Everyone",
      "description": null
    }
  ]
}