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

Creating a new Confluence Space with Postman API

Benjamin Meier May 31, 2020

Hello Community,

 

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

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

 

JSON Body:

{
"key":"MKT",
"name":"Marketing",
"homepage":{
"body":{
"storage":{
"value":"<p>This is the updated text for the new page</p>",
"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.

1 answer

1 accepted

1 vote
Answer accepted
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 3, 2020

Hi Benjamin,

The endpoint you're hitting is to create a page (or some other single piece of content) vs a space (the container that content sits in). For that endpoint, the type field specifies if it's a regular page, a blogpost, etc. From the API documentation:

type REQUIRED

string

The type of the new content. Custom content types defined by apps are also supported.
Valid values: pageblogpostcommentattachment


 

If you're trying to create a space and not a page (as I suspect you are, from what's in your current call), you'll instead want to use the /wiki/rest/api/space endpoint. Documentation for that endpoint is available here and it looks like your request contains all the required parameters.

Cheers,
Daniel

Benjamin Meier June 4, 2020

Hello Daniel,

thank you very much for your answer.

Best regards,
Benjamin

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events