Forums

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

HTTP error 409 with REST API

Deleted user May 16, 2018

I am doing a lot of page updates with Confluence REST API. Sometimes I get an HTTP 409, but I don't understand what is the cause and how to avoid it. 

V6.2.1

My python code is:

def getPageByID (id):
    r = requests.get(BASE_URL + 'content',
        {'id': id,
         'expand': 'version',
        },
        verify = False, auth = AUTH,
    )
    try:
        version = r.json()['results'][0]['version']['number']
    except IndexError:
        print ('ERROR: page not found ({}, {})'.format (id))
        return r
    return (version)

def updatePage(pageID, newtitle, newtext):
    version = int(getPageByID(pageID)) + 1
    return requests.put(BASE_URL + 'content/' + pageID,
        verify = False, auth = AUTH,
        json = {
            "id": pageID,
            "type": "page",
            "title": newtitle,
            "body": {
                "storage":{
                    "value": newtext,
                    "representation":"storage"
                },
            },
            "version": {
                "number": version,
            }
        }
    )

 

2 answers

0 votes
Samy Achour
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!
April 22, 2021

Wondering this as well, did you find a reason?

0 votes
Gonchik Tsymzhitov
Community Champion
October 23, 2018

Hi! 

 

Please, have a look here a few solutions

https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/confluence.py

Also, I will be happy for new Pull Requests. 

 

Cheers,

Gonchik Tsymzhitov

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events