Create Confluence users programmatically

Hi.

Is it possible to create users programmatically in Confluence?

6 answers

1 accepted

Hi.

Now i have another problem.

When i try to create a new user in the way described by Marcin, i get exception: bucket.user.LicensingException: You are not licensed to add any more users to this installation of Confluence. Please contact sales@atlassian.com.

Here's my code:

ConfluenceUserImpl u = new ConfluenceUserImpl("John", "John", "john@john.com");

try{
userAccessor.createUser(u, Credential.unencrypted("123123"));
} catch (Exception e) {
String s = e.getMessage();
return ERROR;
}

Any ideas how to avoid this error?

Do you use Test license for plugin developers?

I use regular Atlassian SDK downloaded from the official website, so i think i have the test license. Or i need to install the license manually? Another question: When i create a new user do i need to be logged in as a admin necessarily?

Sorry for stupid questions i'm novice in atlassian development )

With test licese your server is limited to only 5 users

I am not sure but rather you don't have to be logged as admin. I'll have to check it

Yes, unfortunately if i try to add or remove users via UserAccessor i need to be logged in as an administrator... Are there any ways to avoid this restriction?

Actually there's a possibility to create a user, but there's no possibility to remove. Also there's no possibility to add users to groups.

0 vote
Davin Studer Community Champion Aug 14, 2014

Yes.

General API Documentation
https://developer.atlassian.com/display/CONFDEV/Confluence+XML-RPC+and+SOAP+APIs

User Management Methods for the SOAP API
https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods#RemoteConfluenceMethods-UserManagement

The REST API is now going to be the officially support API going forward so you should get the REST API Browser to be able to see what methods are available. Unfortunately the REST API documentation is pretty slim.

Hi.

Looks like REST API doesnt provide ability to add users like JIRA REST API does. Is it true?

Thanks all for help!

Hi.

Now i have another problem.

When i try to create a new user in the way described by Marcin, i get exception: bucket.user.LicensingException: You are not licensed to add any more users to this installation of Confluence. Please contact sales@atlassian.com.

Here's my code:

ConfluenceUserImpl u = new ConfluenceUserImpl("John", "John", "john@john.com");

try{
userAccessor.createUser(u, Credential.unencrypted("123123"));
} catch (Exception e) {
String s = e.getMessage();
return ERROR;
}

Any ideas how to avoid this error?

So with test license your server is limited to use only 5 users.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

70 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you