create a new child page using confluence rest api

Abhijit Thotas
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!
December 24, 2018

I have tried to create a child page with an ancestor page id using confluence rest api, in C#.

I have tried to post json data with auth header as well but still the response from the API is not authorized. 

While with the same credentials, I am able to create a child page manually, so this definitely might not be authentication issue. 

Any help would be highly appreciated.

 

1 answer

4 votes
Mallmann
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 26, 2018

Hi, Abhijit.

Based on our documentation, the REST call to create a child page would be as the example below:

curl -u admin:admin -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"new page",
"ancestors":[{"id":456}], "space":{"key":"TST"},"body":{"storage":{"value":
"<p>This is a new page</p>","representation":"storage"}}}'
http://localhost:8080/confluence/rest/api/content/ | python -mjson.tool

https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/

 

Based on your description it seems that you're trying to create it through C#, so I believe it would be a good idea to try the mentioned rest call through your terminal or even through an external REST API client (like postman) and check if you are able to create this page before trying in your C# code.

If it works using an external client, please share your C# code with the API call so we can have a better idea of what you're trying there.

Best,

Mallmann

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events