The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Update page using API with markdown content

dustin_butler
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!
May 17, 2024

I'm updating a page with markdown content via the the API.  The update works but the page in Confluence is showing the raw markdown text instead of formatting it.

Here is the API call I'm using to update the page

curl -o output.html -0 -v -X PUT https://inhabitiq.atlassian.net/wiki/api/v2/pages/${ATLASSIAN_PAGE_ID} \
-u "${ATLASSIAN_USER}:${ATLASSIAN_API_TOKEN}" \
-H "Expect:" \
-H 'Content-Type: application/json; charset=utf-8' \
--http1.1 \
--data-binary @- << EOF
{
"id": "${ATLASSIAN_PAGE_ID}",
"status": "current",
"title": "API Documentation",
"body": {
"representation": "storage",
"value": ${NEW_CONTENT}
},
"version": {
"number": 25,
"message": "Updated API documentation"
}
}
EOF

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Deleted user
May 17, 2024

Hello @dustin_butler 

The representation format for markdown is 'wiki' ('storage' is HTML and 'atlas_doc_format' is ADF)

0 votes
dustin_butler
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!
May 20, 2024

Thanks for the reply.  After looking into this some more found that $NEW_CONTENT was being converted from markdown into HTML with pandoc.

 

NEW_CONTENT=$(pandoc -f markdown $(pwd)/docs/docs.md | jq -Rs .);

Was throwing 500 when trying to use wiki representation but all working now. 

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events