Forums

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

Not able to Create a new confluence page as a child of another page

Hardik Rana September 8, 2020

Not able to Create a new confluence page as a child of another page with below curl req:

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"}}}'
https://wiki/rest/api/content/

OS: Windows

Error on using -o with curl:

curl: (7) Failed to connect to port 80: Connection refused

1 answer

0 votes
Nic Brough -Adaptavist-
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.
September 8, 2020

The error you're getting is a network error - it means there is nothing running on port 80 (http) on the url you are hitting, or a firewall is stopping the connection dead.

Check what the base url of the Confluence you are trying to connect to is, I suspect you will find it is not what you are using in curl (it will probably be https)

Hardik Rana September 8, 2020

Yes, I have mentioned in my question. It is https only.

Nic Brough -Adaptavist-
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.
September 8, 2020

But your curl call is over the default http port of 80.  Have you set up 80 to serve up https?  Or are you looking in the wrong place?

Hardik Rana September 8, 2020
curl -D- \
  -u admin:admin \
  -X POST \
  -H "X-Atlassian-Token: nocheck" \
  -F "file=@example.txt" \
  -F "minorEdit=true" \
  -F "comment=Example attachment comment" \
  https://wiki/rest/api/content//123/child/attachment

But I am getting status 200 for the above curl request. 

Nic Brough -Adaptavist-
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.
September 8, 2020

A 200 is a success, now you're on the right url.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events