I made a request like this based on the here answer, but the checkbox is not displayed correctly in Confluence.
curl --request PUT \
--url "https://$domain/wiki/api/v2/pages/$pageid" \
--user "$user:$token" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"id": "<page id>",
"status": "current",
"title": "Create Page from Confluence API",
"body": {
"representation": "storage",
"value": "[] check1"
},
"version": {
"number": 2,
"message": "v2.0"
}
}'
In confluence it looks like this.
Is there a way to display it correctly?
Hi,
- Confluence cloud has moved away from wiki markup (confluences version of markdown)
- Rest api does not support Markdown (the editor does)
Internal storage of pages is in an xml storage format. Hence If you wish to use check boxes and other formatting use xml
E.g
[ ] checkmark box 1
[ ] checkmark box 2
would look like In xml:
<ac:task-list>
<ac:task>
<ac:task-status>incomplete</ac:task-status>
<ac:task-body>checkmark box 1</ac:task-body>
</ac:task>
<ac:task>
<ac:task-status>incomplete</ac:task-status>
<ac:task-body>checkmark box 2</ac:task-body>
</ac:task>
</ac:task-list>
API request:
curl --request PUT \
--url "https://$domain/wiki/api/v2/pages/$pageid" \
--user "$user:$token" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"id": "<page ID>",
"status": "current",
"title": "Create Page from Confluence API",
"body": {
"representation": "storage",
"value": "<ac:task-list><ac:task><ac:task-status>incomplete</ac:task-status><ac:task-body>checkmark box 1</ac:task-body></ac:task><ac:task><ac:task-status>incomplete</ac:task-status><ac:task-body>checkmark box 2</ac:task-body></ac:task></ac:task-list>"
},
"version": {
"number": 10,
"message": "v4.0"
}
}'
We confirmed that it works as expected with xml storage format. thank you :)
By the way, are there any tools available to convert GitHub Markdown to xml storage format?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There doesn’t seem to be a good way to convert markdown -> XML(compatible with confluence).
Points of note:
- Confluence Rest api does not support markdown (you can input to the editor)
- Confluence stores data in and xml/xhtml like form
- Github markdown is an extension of pure markdown and can include some HTML
For context, I attempted the vite README.md
Approaches I tried:
Final thoughts if you only have a few simple files, try a combination of converting the file formats chatgpt and manually editing to get the job done. If you are dealing with many files and want to do it programmatically Mark tool could be a good option (I got the best results, with no manual editing). Note the image below is the process of cutting html converting and recombining with MD. It’s not a perfect result and some image sizes are off but I’d say its about 92% accurate without any manual edits and if you edit the doc in confluence later you can fix some of the sizing and spacing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for answering.
I was trying to convert it programmatically, but Mark tool doesn't seem to support `<ac:task*>`, so I'll try to implement it myself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.