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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,950
Community Members
 
Community Events
176
Community Groups

how to correctly create a page using the API

Sorry if I ask something too obvious but I am quite Junior dev and not familiar with curl at all.

I am trying to create a new page following the documentation but I keep getting a 401 response, although if I use the login sample command in the docu (curl -D- -X GET -H "Authorization: Basic <MyEncodedEmailrAndToken>" -H "Content-Type: application/json"https://myspace/wiki/rest/api/space) ) I get a 200 status response, so I assume my login ddetails are correct.

The command I am using is: curl -D- -H "Authorization: Basic  <MYTOKEN>" -X POST -H 'Content-Type:application/json' https://myspace/confluence/rest/api/content/ -d '{"type":"page","title":"TEST", "space":{"key":"AGE2DE"},"body":{"storage":{"value":"Test","representation":"storage"}}}'

And this is the error I keep gettingError.jpg

1 answer

0 votes
Dominic Lagger Community Leader Jul 25, 2022

Hi @Jesus Fernandez 

Does your user have the permission to create a page in this "AGE2DE" space? 

Regards, Dominic

HI Dominic, I can create pages manually if that is what you mean, but I cannot create them when using the API command mentioned above

@Dominic Lagger I am using the example in the documentation so I am not sure what you mean when saying I do not have any headers as I am basically copying the example there and just modify with my space values

Dominic Lagger Community Leader Jul 26, 2022

Hmm this is a bit strange. I just checked with one of my calls.

I have another header: 

'X-Atlassian-Token': 'no-check'

Can you probably check with this? 

If this does not work, I would suggest you to ask in the developer community. 

https://community.developer.atlassian.com/

Regards, Dominic

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

Atlassian Community Events