Update content API - Not working
Asked by S?ren Dahl Poulsen:

Hi all!   

I am attempting to update the content of a page using REST api.

I am calling this endpoint using PUT: <http://domain/wiki/rest/api/content/3906240556>

With this payload:  

```
{

    "id": 3906240556,

    "type": "page",

    "space": {

        "key": "PK"

    },

    "body": {

        "title": "NEW TITLE",

        "storage": {

            "value": "test test test",

            "representation": "storage"

        }

    },

    "version": {

        "number": 5

    }

}
```

I get a response "200 OK", but nothing is actually updated on the page itself. I can't figure out why that is. Does anyone have any pointers as to what might be the issue?


Answers:
author: Jessica
body: Hi [@S?ren Dahl Poulsen](/t5/user/viewprofilepage/user-id/4968717)

Welcome to the Atlassian Community!

I have tried the same endpoint you used, but if my title is inside the body for example, it doesn't allow me to update and there is no 200 OK for me.  
I'm following this documentation [REST API - Update comment](https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-id-put)  

So, I'd like to ask you to test running something like this, when trying to update the page:

```
 {
"version": {
"number": 5
},
"type": "page",
"status": "current",
"title": "NEW TITLE",
"space": {
"key": "PK"
},
"body": {
"storage": {
"value": "test test test",
"representation": "storage"
}
}
}
```

That should do the trick!  

If that still doesn't work, would you mind sharing the body response?  
Also, keep in mind to use https:// instead of http:// :)

Cheers,  
Jessica

comments: author: Daniel Schmidt
body: Hi Jessica

I am fighting with the same problem like [@S?ren Dahl Poulsen](/t5/user/viewprofilepage/user-id/4968717)

The title will be updated, but the value (page content) is not changing?

Could you please check again on your side.

Here is my Body:

{  
"version": {  
"number": 11  
},  
"type": "page",  
"status": "current",  
"title": "New page update by API",  

"storage": {  
**"value": "test daniel",**   
"representation": "storage"  
}  
}

The value has no function?

BR

Daniel


author: Jessica
body: Hi [@Daniel Schmidt](/t5/user/viewprofilepage/user-id/4615356)

The value has function and I can confirm to you it works, but in your case, it seems it is not really inside the body, like in the example above or in the [REST API - Update comment](https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-id-put) documentation examples, so this seems what is going wrong there.

From what I can see, the storage and value, should be after the body, which there isn't any in your example.  

Could you try this one?  

```
{
"version": {
"number": 12
},
"title": "New page update by API",
"type": "page",
"body": {
"storage": {
"value": "test daniel",
"representation": "storage"
}
},
}
```

Hope this helps.  
Jessica


author: S?ren Dahl Poulsen
body: [@Jessica](/t5/user/viewprofilepage/user-id/3667333) Moving title outside of body and adding using "https" did the trick for me. Thanks!


author: Daniel Schmidt
body: Hi [@Jessica](/t5/user/viewprofilepage/user-id/3667333)

Sorry for my late reply to you.

Your JSON format is working fine for me.

Thanks!

BR Daniel

```
{
"version": {
"number": 12
},
"title": "New page update by API",
"type": "page",
"body": {
"storage": {
"value": "test daniel",
"representation": "storage"
}
},
}
```


author: Tommy Grealy
body: Hi I am still having a similar issue.  

<https://wiki.mydomain.com/rest/api/content/1234567>

(1234567 represents the content-id)   

Using the almost the exact structure above does not post any update to my page. For the "value" - I am actually posting a html string but that is really the only difference. Because it's html - I don't use "storage", instead I use "view" (as directed by the meaning of these different params that are allowable [documented here](https://docs.atlassian.com/atlassian-confluence/5.8.8/com/atlassian/confluence/api/model/content/ContentRepresentation.html))   

```
{
    "version": {
        "number": 4
    },
    "title": "TEST PAGE ONLY V3",
    "type": "page",
    "body": {
        "view":{
            "value": "<h1>Test only - will revert</h1>",
            "representation": "view"
        }
    }
}
```

<br />

<br />

Only if I actually change both version number (increment it by 1) and the TITLE to something new - will it actually create a new page version. Otherwise, nothing happens at all to the page even though I am getting a 200 response to my API call.

I have a couple of questions:

Why do we have a node called "storage" and inside that node we have a key called "representation" who's value is also "storage" - is this not already implied by the top-level node name?


Tags: cloud

confluence-cloud