REST API to create personal space

Robert Egan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2021

I would like to use the Confluence REST API to create a personal space for a user that is not me. However, the very straightforward JSON string of

-d '{"key":"~generic.user","name":"Generic User"}'

fails because of "Invalid space key". Obviously, both the tilde and the period are invalid, but I assumed that the _private option would account for that. Otherwise, why have a special URL just for personal spaces?

So, what am I doing wrong?

3 answers

0 votes
Thiago Masutti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 10, 2021

Hi @Robert Egan 

You can use the legacy RPC API methods to create personal spaces.

There's addition information in this community post: https://community.atlassian.com/t5/Confluence-questions/Confluence-administration-Create-personal-space-for-new-users/qaq-p/765650

I hope that helps.

Kind regards,
Thiago Masutti

Robert Egan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2021

Thanks, but I have decided to write this one off, as the scenario it addresses does not justify the effort required to achieve it.

Hardik Mehta
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 13, 2024

@Thiago Masutti I need REST API. can you please help me on it.

0 votes
Winderson Souza
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 10, 2021

Hi Robert,

Per api documentation:

Create private space

Creates a new space that is only visible to the creator. This method is the same as the Create space method with permissions set to the current user only. 

I believe to achieve what you want to do, you need to create a space and set the permissions only to the user you want it to be the personal space, see the example on https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-api-space-post-example.

Also note that the Key and Name parameters are how you want the space to be identified, so there can not be an auto-handling to it.

Robert Egan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2021

I have no idea how Confluence does it, but clearly they do not use their own API, because they can have tilde and periods in the space name. I have decided to write this one off, as the scenario it addresses does not justify the effort required to achieve it.

Hardik Mehta
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 13, 2024

https://developer.atlassian.com/cloud/confluence/rest/api-group-space/#api-api-space-post-example this link is not available.

 

I want to create persnal space using rest api

0 votes
Joshua Sneed Contegix
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2021

Hi Robert,

I don't believe that administrators can create a personal spaces for a users. This guide shows how a user can create one for themselves. Cheers!

Robert Egan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 10, 2021

So perhaps they should just remove that option from the REST API?

I have been tasked with testing changes to the "default personal space template". If the only personal space I can create is mine, it means I need to delete my existing personal space first. And I'd rather not do that.

In any other environment, I could create a "dummy" account, log into that account, and test it that way. But our system is "locked down" so that you cannot log into dummy accounts.

So my test plan was going to be, create the dummy account, create a personal space for it (without logging in, hence the REST API) and that navigating there by URL.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events