How to update Confluence pages using REST API?

Marcel Scheid April 10, 2016

Hi,

I'm trying to update a Confluence-page via REST.
As a result I'm getting a response code 500. Looking in the atlassian-confluence.log it says:

2016-04-07 14:53:29,973 ERROR [http-nio-172.22.115.49-8090-exec-426] [rest.api.model.ExceptionConverter] convertServiceException No status code found for exception, converting to internal server error : -- url: /confluence/rest/api/content/18822443 | userName: tunupnavi java.lang.IllegalArgumentException: Property with name sync-rev is not a String at com.atlassian.confluence.content.ContentProperties.getStringProperty(ContentProperties.java:86) at com.atlassian.confluence.content.apisupport.ContentCreator.setSyncRevOnEntity(ContentCreator.java:196) at com.atlassian.confluence.content.apisupport.ContentCreator.setCommonPropertiesForUpdate(ContentCreator.java:182) at com.atlassian.confluence.api.impl.service.content.typebinding.PageContentTypeApiSupport.update(PageContentTypeApiSupport.java:164) at com.atlassian.confluence.api.impl.service.content.typebinding.PageContentTypeApiSupport.update(PageContentTypeApiSupport.java:42) at com.atlassian.confluence.api.impl.service.content.ContentServiceImpl.updateUsingApiSupport(ContentServiceImpl.java:126) at com.atlassian.confluence.api.impl.service.content.ContentServiceImpl.update(ContentServiceImpl.java:176)


What is going wrong?

I'm using Confluence 5.9.3 with an Oracle DB.

 

Thanks,

Marcel

12 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Marcel Scheid October 19, 2017

The Problem seems to be fixed with version 5.9.14: https://jira.atlassian.com/browse/CONFSERVER-41493

0 votes
Roman Karpushkin August 23, 2016

Hi all. I don't know if it's still an issue for anyone. Our instance had same problems with update and we got rid of this by migrationg data from Oracle DB to MS SQL DB.

Atlassian sent me their solution, but I was done with migration by this time, so I don't know if it's permanent.

Here is their answer:

It's seems that the additional entries in the contentproperties table has cause the problem with updating the page. We are still uncertain on what has trigger the additional "sync-rev" entries to be added into the table even though it is not used yet.

Good news is that, we are able to find a fix for this problem by removing the entry related to the sync-rev values directly from the database. Thus, please :

  1. backup the database since this require manual database delete
  2. run the following SQL query:
    // identify how many entries need to be deleted
    select count( distinct propertyid) from CONTENTPROPERTIES where propertyname='sync-rev';
    
    
    // delete all of the entries
    delete from CONTENTPROPERTIES where propertyname='sync-rev';
    
  3. restart Confluence instance
  4. verify if the problem persist

 

 

Hung Nguyen October 10, 2016

The answer from Atlassian doesn't work for me. After deleting the entries, and restart the instance, the entries came back after that and the problem persisted

 

0 votes
Stephan Hassenpflug August 22, 2016

Hi Together,

 

I am really suffering with this issue.

  • The space was already included in my request. 
  • Putting the it in breackets or not does not make a difference for me

Is there any solution to this issue? What do you need to check?

Stephan

0 votes
Stephan Hassenpflug August 17, 2016

So what is the solution?

0 votes
Marcel Scheid April 14, 2016

This matches my guess, since I am able to update a page right after I manually edited it but not after about an hour.

We upgraded from v5.8.5 to v5.9.3 and switched from HSQL to Oracle DB at once.

0 votes
Roman Karpushkin April 14, 2016

We have the same issue after update to v5.9.7, and I suspect database update might be the reason.

What was your scenario for upgrading Confluence?

0 votes
Marcel Scheid April 14, 2016

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning option

0 votes
Roman Karpushkin April 14, 2016

Marcel, what Oracle DB version are you using?

0 votes
Marcel Scheid April 12, 2016

Thanks for your advice but unfortunately it had no effect...

0 votes
Ravi Varma
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2016

Please add space as one of the inputs and check once. I used the same request along with space from my Java application.

"space":{"key": "test"}

0 votes
Marcel Scheid April 11, 2016

My request:

PUT https://confluence.sha.vrkw.de/confluence/rest/api/content/18837679 HTTP/1.1

[Content-Type: application/json; charset=UTF-8,Content-Length: 1819,Chunked: false]

{"id":"18822443","type":"page","title":"_VkAKQGaBEeWW-_fJrjeK2A","version":{"number":3},"ancestors":[{"id":"18821974"}],"body":{"storage":{"value":"<h2>hello</h2>","representation": "storage"}}}

{http.auth.credentials-provider={<any realm>@confluence.sha.vrkw.de=[principal: tunupnavi]}, http.auth.auth-cache={https://confluence.sha.vrkw.de:443=[B@139a76}}

David Jackson May 6, 2016

Do the id values need to be in quotes? shouldn't it be "id":18822443?

David Jackson May 8, 2016

Maybe i'm misreading it, but when I searched for Ancestors I see this: 

"ancestors":[{"id":456}] 

with no quotes around the integer?

Marcel Scheid May 8, 2016

You are right, there are no quotes around the ancestor-id in the documentation. When I'm sending a GET request there are quotes tho:

"ancestors": [{

        "id": "4259846",

        "type": "page",

        "status": "current",

        "title": "NUP",

        "extensions": {

            "position": 1

        }]

0 votes
Ravi Varma
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2016

Please post the Confluence REST API request as well

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events