Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Im getting Internal Server Error 500 when updating a confluence page via Curl

 

The curl call im using is this one:

curl --location --request PUT http://localhost.com:8090/rest/api/content/21169510 --header "Accept: application/json" --header "Content-Type: application/json" --user user:password  --data "{\"id\": \"21169510\",\"type\": \"page\",\"title\": \"Test Doors\",\"space\": {\"key\": \"TOOL\"},\"body\": {\"storage\": {\"value\": \" <p class=\"auto-cursor-target\"><br /></p><table><colgroup><col /><col /><col /></colgroup><tbody><tr><th>KPI</th><th>KPI</th><th>KPI</th></tr><tr><td>1</td><td>1</td><td>1</td></tr><tr><td>1</td><td>1</td><td>1</td></tr></tbody></table><p class=\"auto-cursor-target\"><br /></p>  \",\"representation\": \"storage\"}},\"version\": {\"number\": \"13\"}}"

Im getting problems when updating the content of a page with something more complex than a simple sentence (in this case it works perfectly). If i dont use the \" with the body-storage-value, it gets an error with the < character, and if i use it, it answers with 500 internal server error. in this case i was trying to create a table.

Does anybody know what am I doing wrong?

1 answer

0 votes
Thomas Deiler Community Leader Oct 14, 2021

Dear @Pablo Garijo ,

I know this kind of problems - made the same xp in the past. In most cases its a problem with encoding / escaping special chars.

I recommend to use first a browser extension for posting REST calls. There you can step by step debug you JSON payload.

Then I also recommend to call curl from a script. Python or PHP are pretty fine. They have both functions to encode the data to UTF-8.

So long

Thomas

Thank you for your answer. Using Postman I am able to do it, but i need  to use the curl commands so i can automate it later. Its just matter of knowing how do i need to introduce the data for the body content, and how do i need to put the \" characters. I am able to do it creating a Json from the command line and adding in there the variables but that is significantly more difficult. So if anyone knows how to solve my doubt it would be great.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,539 views 7 29
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you