Update User's Departments

Updates information of Departments that a User belongs to, and Job Title information related to the Department.

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

Contents

Permissions

Only Administrators (External link) can use this API.

Request Parameters

Parameter Value Required Description
userOrganizations Array of Objects Yes A list of objects containing users that will have their affiliated departments updated.
userOrganizations[].code String Yes The User's code (log-in name).
The maximum limit is 128 characters.
Values consisting of only whitespaces or null are not allowed.
userOrganizations[].organizations Array of Objects Yes An array of organizations objects containing data of Departments the users will be a member of.
The maximum limit is 100 objects.
Any existing Department that is not set for this parameter will result in the user being removed from that department.
If the array is empty, the user will not be a member of any Department.
userOrganizations[].organizations[].orgCode String Conditional The Department Code of the Department to add the user to.
The maximum limit is 128 characters.

Required when specifying a Job Title.
userOrganizations[].organizations[].titleCode String The code of the Job Title.
The maximum limit is 128 characters.

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
var body = {
  'userOrganizations':
    [
      {
        'code': 'sample_user_code',
        'organizations': [
          {
            'orgCode': 'sample_department_code',
            'titleCode': 'sample_job_title_code'
          }
        ]
      }
    ]
};

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

curl Sample

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$ curl -X PUT \
  https://{subdomain}.kintone.com/v1/userOrganizations.json \
  -H 'X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=' \
  -H 'Content-Type: application/json' \
  -d '{"userOrganizations":
        [
          {
            "code": "sample_user_code",
            "organizations": [
              {
                "orgCode": "sample_department_code",
                "titleCode": "sample_job_title_code"
              }
            ]
          }
        ]
      }'

Sample Response

1
{}

Limitations

  • Deadlocks may occur if the following are operated simultaneously:
    • A System Administrator imports a CSV file (External link) through the GUI to update users in the domain.
    • The Update User's Departments API is used.