User API
On this page you'll find examples of how to use and implement the User API.
Creating users
This covers all the actions required to create functional users:
- Creating users in the database
- Associating users to a domain
- Creating a mailbox
- Creating a default calendar
- Creating a default calendar view
- Creating "My contacts" and "Collected contacts" address books
HTTP example
- Method : PUT
- URL :
https://<domain.lan>/api/users/<domain.lan>/<user's uid>
- BODY :
{
"emails": [{
"address": "john@<domain>",
"allAliases": false,
"isDefault": true
}],
"login": "john",
"password": "doe",
"contactInfos": {
"identification": {
"name": {
"familyNames": "Doe",
"givenNames": "John"
},
"photo": false
}
},
"routing": "internal",
"accountType": "FULL"
}
Curl example
curl -X GET --header 'Content-Type: application/json' \
--header 'X-BM-ApiKey: <auth_key>' \
--header 'Accept: application/json' \
-d '{
"emails": [{
"address": "john@<domain>",
"allAliases": false,
"isDefault": true
}],
"login": "john",
"password": "doe",
"contactInfos": {
"identification": {
"name": {
"familyNames": "Doe",
"givenNames": "John"
},
"photo": false
}
},
"routing": "internal",
"accountType": "FULL"
}' https://<domain>/api/users/<domain>/<uid>
Example in Java (using the BlueMind generated client)
IUser userService = serviceProvider.instance(IUser.class, domain);
User user = new User();
user.login = "john";
user.password = "doe";
user.routing = Routing.internal;
user.emails = Arrays.asList(Email.create(login + "@" + domain, true));
user.contactInfos = new VCard();
user.contactInfos.identification.name = new Name();
user.contactInfos.identification.name.givenNames = login;
String userUid = UUID.randomUUID().toString();
userService.create(userUid, user);