Uploading Markdown to confluence cloud via REST

Afternoon All!

I’m writing a couple of bash scripts for my client and one of these scripts is to upload markdown files from various git repos in the CI pipeline.

Now i can quite happely upload the document using curl

msg="{“title”: “”,“type”: “page”,“space”: {“key”: “SPACEKEY”},“ancestors”: [{“id”: “$1”}], “version”: { “number”: “0” }, “body”: {“storage”: {“value”: “MARKDOWN GOES HERE”,“representation”: “wiki”}}}"

curl -s -X POST --header “$authHeader” --header “Accept: application/json” --header “Content-Type: application/json” --data “$msg” --url “$1”

Now the page is created on the server and the content is indeed set whatever i pass into storage.value. but the rendering is not correct. I found a few posts that said to use the “wiki” representation but that didn’t make a difference.

Any ideas?

Hi @CedricBrasey , welcome to the Community!
Can you please let us know what is not correct about the rendering? Any snapshots of observed rendering would be helpful for us too.

Thanks

This is not exactly what you asked for, but I believe it can be helpful:

This Python project converts MD into HTML first, and then uploads it into Confluence.

Hi,

Another option would be to save the content into the macro body of the macro provided by this Marketplace app:

Then you wouldn’t have to worry about conversion.

Full disclosure: I belong to the organization that wrote this Marketplace app.