Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Adding Users to Confluence Cloud with the REST API?

Help Desk February 16, 2016

Hi! 

I'm trying to add users to our Confluence Cloud instance programmatically. The version appears to be 6.0.0-OD-2016.01.1-0002. Presumably current.

We're pretty heavy users of the REST API for on-premises JIRA instance, so the concepts are not entirely unfamiliar. In the latest documentation for Confluence REST API, there are no references to creating users. The only reference I can find for creating users is in the XML-RPC API documentation, which indicates it was deprecated since v5.5.

I was also told within the past month or so by Atlassian support that I should be able to use the JIRA REST API to manage users in Confluence Cloud. They even sent documentation references to the JIRA API. 

So naturally I tried. Using Postman (in Chrome) or curl produces the same result: a 503 Service Temporarily Unavailable status and an HTML custom error page with the title "Atlassian Cloud Notifications - Page Unavailable". 

It's a simple post, right? Authorization header, Base64 encoded, https to /rest/api/2/user, content-type JSON, and a body that contains something like this:

{

"name" : "Test",
"password" : "TestAccount123",
"emailAddress" : "fdfd@fdfd.com",
"displayName" : "Test Account",
}

All results are 503 and the custom error page as HTML. 

 

Even a simple search or get returns the same.

curl.exe -D -u user@company.com -X GET -H "Content-Type: application/json" https://company.atlassian.net/rest/api/latest/user/search?username=user@company.com

So I suspect "Use the JIRA REST API" isn't the correct advice.

 

I have a functional bit of code using the XML-RPC API, but as the documentation indicates, it's deprecated. I'd prefer something with some long term support. Additionally, this method works "sometimes". I've had it work, and I've also had a few cases where it creates the accounts but leaves them in an unusable state that requires Atlassian support to go into the database and fix something up. Not exactly sure what they are doing, but I think they "sync" something. I'd be alright with this method in the short term if it were more reliable.

 

So I guess my question is: 

Other than the deprecated XML-RPC API, which hasn't been the most reliable, is there a way to create users programmatically in Confluence Cloud? 

 

Thx for your time!
Bryan

 

 

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Matthew Schultz April 26, 2016

Don't know if you figured this out, but by adding a user to the 'confluence-users' group via the API, you grant them access to Confluence. I have some sample Ruby code I could share, if you're still looking for a solution.

rcsrao October 5, 2017

Please post your code?

0 votes
Help Desk February 16, 2016

Thanks, Joel. That option is enabled.

 

 

joelcwe February 16, 2016

Sorry, you are right. User management isnt available in the new confluence rest api. https://docs.atlassian.com/atlassian-confluence/REST/latest/

0 votes
joelcwe February 16, 2016

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events