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,
}
}
)