Forums

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

Updating ConFluence page Using Node.js

Anthony_Gregg
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 25, 2025

I am currently writing a script that does the following using node.js:

  • Pulls existing confluence to pull in page content in HTML using GET request,
  • Updates HTML by adding new HTML tags (H1, H2 UL, and UI) to an existing H1
  • I then create a PUT request to update the given page.

 

Here is a sample of the curl request I'm using:

curl -X PUT \
-H "Authorization: Basic <Base64_encoded_credentials>" \
-H "Content-Type: application/json" \
-d '{
"type": "page",
"id": "12121212",
"title": "Week 24 Jan 2025",
"body": {
"storage": {
"value": "<p>AI Generated Status Update - Test Page!</p>...",
"representation": "storage"
}
},
"version": {
"number": 2
}
}' \
When I directly make a PUT call to confluence with the above call I was able to get a 409 error because I needed to increment the version number. But when I tried with the full body.storage.value stringified HTML content I got back an error 
{
"statusCode": 500,
"message": "",
"reason": "Internal Server Error"
}
Is there any stipulations on what the HTML should look like in a PUT request or guidelines that I should be using? 

1 answer

0 votes
Philipp Sendek
Community Champion
April 4, 2025

Hi @Anthony_Gregg ,

welcome to the community. Is the provided URL the exact URL you're using (except for your-domain, of course :-))?
The endpoint you're using is deprecated but should still work. I can't spot the exact error in your request, but using the following documentation you might be able to find it yourself: https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content/#api-wiki-rest-api-content-id-put

The current version of the documentation and the endpoint you'd need to use would be this: https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-put

 

I hope this helps you solve your problem.

Greetings
Philipp

Philipp Sendek
Community Champion
April 23, 2025

Hi @Anthony_Gregg ,

just checking in whether you could solve your problem. Also, if my answer helped you, I'd appreciate if you could accept my answer.


Thank you and Greetings
Philipp

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events