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.
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/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.