Hey,
this question is very close to this one: create page from blueprint in java
the difference is that my goal is to create a space.
I created a space-blueprint in my plugin and want to create a space based on this blueprint.
I found the following classes but can't figure out how i can achieve my goal:
SpaceBlueprintManager (Is not an OSGI Component - @ComponentImport doesn't work)
SpaceBlueprintService (Seems like it needs the SpaceBlueprintManager, but can't figure out how to get the manager)
The ContentBlueprintManager is apparently only for creating pages ..
any help is appreciated :)
Ok found a REST-Method, no need to use java api:
{host:port}/rest/create-dialog/latest/space-blueprint/create-space
Method: POST
Headers:
Content-Type: application/json
User-Agent: xyz -> Just use some dummy here e.g. 'xyz' :)
Body:
{
"name": "NAME",
"description": "DESCRIPTION",
"context": { },
"permissions": "PERMISSIONS",
"spaceBlueprintId": "ID",
"spaceKey": "SPACE-KEY"
}
You can get the space Blueprint id by using this method:
Method: GET
{host:port}/rest/create-dialog/latest/space-blueprint/list
this will give you a list with all space blueprints and their ids :)
Thank you @Maximilian
I tried your suggestion and it works!
The below request creates a space with Knowledge base template
curl -u admin:password -X POST -H 'Content-Type: application/json' -d'{"spaceKey":"KM","name":"KB API Test","spaceBlueprintId":"279af294-8caa-4b6d-88f8-67161c18a060","context":{"name":"KB API Test","spaceKey":"KM","spaceDesc":"REST API Space creation using Knowledge base template ","noPageTitlePrefix":"true","ContentPageTitle":"KB API Test"}}' http://localhost:8090/rest/create-dialog/1.0/space-blueprint/create-space
The key is, we need to specify the spaceBlueprintId as part of JSON payload otherwise it will just create the default blank space. We can also get the spaceBlueprintId for each space template from AO_54C900_SPACE_BLUEPRINT_AO
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.