Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create Page Confluence REST API

Jeet G April 5, 2017

Hi,

 

I'm trying to use the confluence REST Api for server.

I want to create a new page before populating it with some content. I managed to get get an existing page and edit it.

This functionality will be a part of a jira-plugin later on.

 

Thanks!

2 answers

2 votes
Sam Hall
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.
April 5, 2017

Hi Jeet - since this is development related, you might want to try asking this over at: https://community.developer.atlassian.com as well (if you haven't already).

There's a lot of helpful and experienced people over there. You might well get a quicker responses in there than on here.

Sam Hall
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.
April 5, 2017
Like • Carike Blignaut-Staden likes this
2 votes
Phillip Ponzer [Cprime]
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.
April 5, 2017

You should be able to POST a new page by sending a POST command to:

<Confluence Base URL>/rest/api/content/

with the following JSON in the body:

{
  "type":"page",
  "title":"My Test Page",
  "space":{"key":"TST"},
  "body":{
    "storage":{
      "value":"<p>This is a new page</p>",
      "representation":"storage"
    }
  }
}

This was retrieved from the documentation:

https://developer.atlassian.com/confdev/confluence-server-rest-api/confluence-rest-api-examples#ConfluenceRESTAPIExamples-Manipulatingcontent

Jeet G April 5, 2017

Thanks for the response.

When I run the post command on my localhost this is the response:

HTTP/1.1 405 Method Not Allowed [Server: Apache-Coyote/1.1, Allow: HEAD,DELETE,GET,OPTIONS,PUT, X-Content-Type-Options: nosniff, Content-Type: text/html;charset=utf-8, Content-Language: en, Content-Length: 1056, Date: Wed, 05 Apr 2017 19:40:18 GMT]

However in the Confluence Server API the create page method is a POST method. 

For reference: https://docs.atlassian.com/atlassian-confluence/REST/latest-server/#content-createContent

Pavel Potcheptsov
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.
April 5, 2017

Show your exact command and payload.

Orlando_Kelly April 17, 2017

You need to set you authentication header to basic and send your username / password

Like • william_larson1 likes this
Anirudh G Polawar
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!
July 30, 2020

Yeah can you give the example like any HTTP request.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events