Forums

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

How to create a confluence page from python

Gurram Chandra Kishore
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!
March 18, 2022

i need to create a confluence page from python script and should be able to edit from the same python script if needed.

curl -i -X POST \
-H "Authorization:Basic <my-api-token>" \
-H "Content-Type:application/json" \
-H "X-Atlassian-Token:no-check" \
"https://gskr.atlassian.net/wiki/rest/api/content/" \
-d '{
"space" " {"key": "FIR" },
"type": "page",
"title": "Page Created from shell script",
"body": {
"storage": {
"value": "This is my page Content generated from shell script",
"representation": "wiki"
}
}
}'

i used the above shell script but i got authentication error.

1 answer

0 votes
Aron Gombas _Midori_
Community Champion
March 18, 2022

In the authorization header, it is not enough to pass the API token!

In fact, you should:

1. take this string: "yourusername:yourapitoken"

2. base64-encode it

3. pass the resulted string in the "Authorization" header

See this page: https://developer.atlassian.com/cloud/confluence/basic-auth-for-rest-apis/

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, marketing templates, confluence templates, marketing project management, content strategy, campaign planning, marketing collaboration, confluence for marketers, atlassian learning, marketing workflows, confluence best practices

5 must-use templates for Marketing teams (from a Confluence Marketer!) 👩🏻‍🎨

Who doesn’t love a good template? We sure do! Check out our top template picks for Marketing teams who want to streamline their processes, enhance collaboration, and take their marketing to new heights.

Read more 📚
AUG Leaders

Atlassian Community Events