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?
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
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
Hi Jessica
I am fighting with the same problem like @Søren Dahl Poulsen
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jessica Moving title outside of body and adding using "https" did the trick for me. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jessica
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"
}
},
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
{
"version": {
"number": 4
},
"title": "TEST PAGE ONLY V3",
"type": "page",
"body": {
"view":{
"value": "<h1>Test only - will revert</h1>",
"representation": "view"
}
}
}
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.