Get Departments

Gets information of departments.

MethodGET
URLhttps://{subdomain}.kintone.com/v1/organizations.json
Authentication Password Authentication , Session 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
ids Array Optional A list of Department IDs, as ID types.
Up to 100 ids can be specified.
For more information on ID types, refer to the following link:
ID type
codes Array Optional A list of Department Codes, as Strings.
Up to 100 codes can be specified.
offset Integer Optional The offset.
If ignored, this value is 0.
size Integer Optional The maximum number of Department information to get.
If ignored, this value is 100.

*If ids and codes are both ignored, up to 100 ids will be responded in ascending order of id.

**If ids and codes are both set, an error will return. Only one can be set.

Sample Request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var body = {
  'code': 'sample_user_code'
};
kintone.api(kintone.api.url('/v1/organizations.json', 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/organizations.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
organizations Array A list of department information, as organization types, in ascending order of id.
For more information on organization types, refer to the following link:
organization type

Sample Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "organizationTitles": [
    {
      "organization": {
        "code": "B",
        "description": "sample description",
        "id": "2",
        "localName": "sample localName",
        "localNameLocale": "en",
        "name": "Organization B",
        "parentCode": "A"
      },
      "title": {
        "code": "leader",
        "description": "leader",
        "id": "1",
        "name": "leader"
      }
    }
  ]
}