It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

create new user in confluence with rest API

Zymergen Admin Oct 09, 2015

Is there a way to create a new Confluence user with the rest API?

https://docs.atlassian.com/atlassian-confluence/REST/latest/#d3e193 appears to really only be about spaces and pages but nothing regarding user administration

3 answers

2 votes
Guilherme Viana Atlassian Team Oct 12, 2015

You can create a user directly in the database:

Let me share an example of how to create one(new administrator user).

insert into cwd_user(id, user_name, lower_user_name, active, created_date, updated_date, first_name, lower_first_name, last_name, lower_last_name, display_name, lower_display_name, email_address, lower_email_address, directory_id, credential) values (1212121, 'admin', 'admin', 'T', '2009-11-26 17:42:08', '2009-11-26 17:42:08', 'A. D.', 'a. d.', 'Ministrator', 'ministrator', 'A. D. Ministrator', 'a. d. ministrator', 'admin@example.com', 'admin@example.com', (select id from cwd_directory where directory_name='Confluence Internal Directory'), 'x61Ey612Kl2gpFL56FT9weDnpSo4AV8j8+qx2AuTHdRyY036xxzTTrw10Wq3+4qQyB+XURPWx1ONxp3Y3pB37A==');
 
 
insert into user_mapping values ('2c9681954172cf560000000000000001', 'admin', 'admin');
insert into cwd_membership (id, parent_id, child_user_id) values (888888, (select id from cwd_group where group_name='confluence-users' and directory_id=(select id from cwd_directory where directory_name='Confluence Internal Directory')), 1212121);
insert into cwd_membership (id, parent_id, child_user_id) values (999999, (select id from cwd_group where group_name='confluence-administrators' and directory_id=(select id from cwd_directory where directory_name='Confluence Internal Directory')), 1212121);

 

Cheers,

Vatsug Nesnej Feb 01, 2017

Thank you for this, it worked!

I will add that with your script, the password for the new user is simply "admin". Do you know what kind of hashing is used for the password, so I can choose another password?

Miguel Campos Varea Sep 04, 2018

Hello Guilherme,

I have a question about your example.

how do you figure out that the right id for table cwd_user is 1212121?

 

Is there any sequence? any table to control how to generate those ids?

Thanks.

1 vote
Stephen Deutsch Oct 10, 2015

You can't use the REST API, because they haven't implemented it yet, but you can still use the older RPC API.  It is used somewhat similarly to the REST API, but instead of giving it an HTTP verb (GET, POST, UPDATE, DELETE), you always send it a POST (and make sure that the content type is "application/json").  Here is some more information about what you can do with user administration:

https://developer.atlassian.com/confdev/confluence-rest-api/confluence-xml-rpc-and-soap-apis/remote-confluence-methods#RemoteConfluenceMethods-UserManagement

0 votes
Steven Behnke Community Leader Oct 09, 2015

Not sure myself...

yourdomain.atlassian.net/rest/api/2/user

Using REST API to create a user account in "On demand JIRA".

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Off-topic

Disney Live Action Reboots: Are you for or against?

Happy Friday Everyone! Today marks the international release of Disney's live action version of the animated classic Aladdin. I know that this movie was met with some controversy of over cast...

168 views 21 10
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you