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

500 Error when trying to update content through API rest/api/content

Hello! 

I've found some questions heree looking similar, but solutions from them didn't work, so...

I call confluence API through Postman.
URI: https://wiki.mycompany.com/rest/api/content/160172480

PUT

headers are OK, authorization basic and creds are right.

Request:

{
    "version":  {
        "number": 5
    },
    "title": "my_test_page",
    "type": "page",
    "body": {
        "storage": {
            "value": "TEST! TEST!"
        }
    }
}
Response:
{
    "statusCode": 500,
    "data": {
        "authorized": false,
        "valid": true,
        "allowedInReadOnlyMode": true,
        "errors": [],
        "successful": false
    },
    "message": "",
    "reason": "Internal Server Error"
}
I see, that authorization did't work, but why? GET responses are success even with wrong creds (anonimous read-only access). Through UI page edit work fine.

2 answers

1 accepted

1 vote
Answer accepted

Hi @VADIM RAKU Welcome to the Atlassian Community!

Can you try below JSON body and see if that works for you

{

  "type":"page",
  "title":"my_test_page",
  "version":{"number":5},
  "space":{"key":"MySpace"},
  "body":{
    "storage":{
      "value":"<p>Some Updated Content</p>",
      "representation":"storage"
    }
  }
}
*Update your Space key, page title etc as needed.

You are a live savior! Thank you very much!!!

Like Kishan Sharma likes this
Kishan Sharma Community Leader Dec 20, 2021

Happy to Help 😊

As 500 means "internal error" and as you tagged this as Server/DC instance - for these types of errors you would typically consult the applications logs (either if you have access to atlassian-confluence.log, or your admins). 500 roughly speaking should always be application-related errors, not that you would be supplying wrong parameters or payload. Almost, almost always there will be an error stacktrace thrown into the log with more details, when you happen to reproduce a 500.

As the answer at bottom says, i should send a space key as well as storage constant value. :)

OMG, Atlassian, why you haven't done an error message with 400, why 500?!

Suggest an answer

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

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

978 views 7 42
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