Creating a new Confluence Space with Postman API

Hello Community,

I am trying to create a new Space in my Confluence using REST API. I am using the following commands:

POST: https://<>.atlassian.net/wiki/rest/api/content/

JSON Body:

{
“key”:“MKT”,
“name”:“Marketing”,
“homepage”:{
“body”:{
“storage”:{
“value”:“

This is the updated text for the new page

”,
“representation”:“storage”
}
}
},
“metadata”:{}
}

I am using basic Authentification. Unfortunately, Postman returns the following:

{ “statusCode”: 400, “data”: { “authorized”: true, “valid”: false, “errors”: [ { “message”: { “key”: “type is required to create content”, “args”: [] } } ], “successful”: false }, “message”: “com.atlassian.confluence.api.service.exceptions.BadRequestException: Could not create content with type null”}

Unfortunately I cannot see which kind of “type” is required and where I can set it.

Thank you very much for your help and have a nice day.

Hi @BenjaminMeier,

I think the error is due to missing the type attribute. It should be one of page , blogpost , comment , or attachment. The /wiki/rest/api/content is for creating content (pages, etc), but you need to POST to /wiki/rest/api/space in order to create a space.

Regards,
Dugald

Hello @dmorrow ,

thank you very much for your answer, you helped me very much.

Best regards,
Benjamin

1 Like