Cannot create confluence space using rest API

Yuliyan Serbezki November 5, 2024

I'm just trying to create a space, but I can't figure out the right request. The endpoint I'm using is https://<my-company>.atlassian.net/wiki/api/v2/spaces and I'm using a POST request.

My first request had the following body:

Body = @{ 

key = "YTST"

name = "YuliTest"

} | ConvertTo-Json

and that resulted in a 404. The documentation says that 404 means the user does not have permissions, but I then logged in with the user whose token I'm using and created a space through the portal, so I guess it's not a permissions issue. 

Anyone have any ideas? I also tried adding a description, but that also resulted in a 404:

 

Body = @{

key = "YTST"

name = "YuliTest"

description = @{

value = "created by automation"

representation = "plain"

}

} | ConvertTo-Json

 

1 answer

1 vote
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2024

Hi @Yuliyan Serbezki 

Can you please check this REST API page?

It seems URL seems a bit different.

POST - Create space

Also, see this Manage API tokens for your Atlassian account.

 

Yuliyan Serbezki November 6, 2024

Isn't that the v1 version of the API? I was trying to use the newer API and followed the schema described here: https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-space/#api-spaces-post.

Regarding the tokens I authenticate successfully when I do a get request so I believe my auth headers are okay, it's something else that doesn't work.

Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2024

Okay, you use v2 and auth is done in correct way if you can do get request. (Create Space is still in experimental status in v2)

Like Yuliyan Serbezki likes this
Yuliyan Serbezki
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!
November 6, 2024

Yes, I guess my question is - is there a way to get the new API to work or should I just use the old one? I can't find any working example with the new one.

Will Stampley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 10, 2024

The v2 creation API is for members of the RBAC Early Access Program. It only exposes role-based configuration options, and not the current granular space permission configuration body. If you're just trying to make a space programatically, and you're not in the RBAC early access program, please use the v1 API that was linked above.

Like Yuliyan Serbezki likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events