Updates user codes of users.
Method | PUT |
URL | https://{subdomain}.kintone.com/v1/users/codes.json |
Authentication |
Password Authentication |
Content-Type | application/json |
Permissions
Only
Administrators
can use this API.
Request Parameters
A "codes" array consisting of an object formed by the below properties is to be specified in the request. User Codes of up to 100 users can be updated.
Parameter |
Value |
Required |
Description |
currentCode |
String |
Yes |
The current User Code (log-in name). The maximum limit is 128 characters. Values consisting of only whitespaces or null are not allowed. |
newCode |
String |
Yes |
The new User Code (log-in name). The maximum limit is 128 characters. Values consisting of only whitespaces or null are not allowed. |
Sample Request
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
var body = {
'codes': [
{
'currentCode': 'user1',
'newCode': 'user1-new'
},
{
'currentCode': 'user2',
'newCode': 'user2-new'
}
]
};
kintone.api(kintone.api.url('/v1/users/codes', true), 'PUT', 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
|
var body = {
'codes': [
{
'currentCode': 'user1',
'newCode': 'user1-new'
},
{
'currentCode': 'user2',
'newCode': 'user2-new'
}
],
// CSRF TOKEN: Needs to be set when using API (POST, PUT, DELETE) from Kintone
'__REQUEST_TOKEN__': kintone.getRequestToken()
};
var url = 'https://{subdomain}.kintone.com/v1/users/codes.json';
var xhr = new XMLHttpRequest();
xhr.open('PUT', 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
An empty JSON object will be returned.
Sample Response