Forums

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

500 Internal Server Error to update content after attaching pdf doc. on confluence using a RESTApi

Anil Kummari June 11, 2023

Hi,

I'm creating a new version of the page after attaching a pdf doc. using a REST api. But seeing 500 Server Error: Internal Server Error for url:rest/api/content/<contentid>

Below is the snippet:

 

new_content = f'{current_content}<ac:structured-macro ac:name="viewpdf"><ac:parameter ac:name="name">att190068</ac:parameter></ac:structured-macro>'
print(new_content)
update_url = f'{confluence_url}/rest/api/content/{page_id}'
print(update_url)
payload = {
    "version": {"number": version_number + 1},
    "title": page_data['title'],
    "type": page_data['type'],
    "status": "current",
    "ancestors": [
        {"id": 123456} ],
    "body": {"storage": {"value": new_content, "representation": "storage"}}
}
print(payload)
# headers['Content-Type'] = 'multipart/form-data'
response = requests.put(update_url, auth=(username, password), headers=headers, data=payload)

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events