Whenever I update a page, I get a Bad Request error, even though the page is successfully updated. My guess is that it has something to do with the metadata property for changing the editor version (which works as expected too). If I remove this editor metadata, I get no more errors.
What is it I'm missing? Is it the permission of the user? Is there something else that must be passed along with the editor metadata?
{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: Error occurred when updating content property editor. Cannot update content property.
PUT /wiki/rest/api/content/{id} (omitting ids and such)
{"title":"<title_omitted>","type":"page","space":{"key":"<key_omitted>"},"status":"current","container":{"id":"<id_omitted>","type":"page"},"ancestors":[{"id":"<id_omitted>"}],"body":{"storage":{"value":"<markdown_value_omitted>","representation":"wiki"}},"version":{"number":24},"metadata":{"properties":{"editor":{"value":"v2"}}}}
Response full error (omitting ids and such):
{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: Error occurred when updating content property editor. Cannot update content property. Property : JsonContentProperty{id='null', key='editor', content=ExpandedReference{idProperties={status=current, id=ContentId{id=<id_omitted>}, version=ExpandedReference{idProperties={number=24}, of=some(Version{by=null, when=null, message='null', number=24, syncRev='null', syncRevSource='null', ncsStepVersion='null', ncsStepVersionSource='null', confRev='null', content=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Content}})}}, of=some(Content{id='ContentId{id=<id_omitted>}', type=page, title='<title_omitted>', status=current, space=ExpandedReference{idProperties={key=<key_omitted>}, of=some(Space{key='<key_omitted>', name='null'})}, history=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.History}, version=ExpandedReference{idProperties={number=24}, of=some(Version{by=null, when=null, message='null', number=24, syncRev='null', syncRevSource='null', ncsStepVersion='null', ncsStepVersionSource='null', confRev='null', content=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Content}})}, ancestors=[Content{id='ContentId{id=<id_omitted>}', type=null, title='null', status=current, space=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Space}, history=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.History}, version=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Version}, ancestors=null (CollapsedList), container=EmptyReference{referentClass=interface com.atlassian.confluence.api.model.content.Container}, childTypes={}}], container=ExpandedReference{idProperties={}, of=some({id=<id_omitted>, type=page})}, childTypes={}})}, version=null} , isSuccessful: false, isAuthorized: true, isValid: false, hasErrors: true, Errors: \"jsonproperty.version.required\""}
OK, I've got it now. Not exactly fixed, but working. So, I'm going to leave this here.
Lemme highlight that even though I get a bad request, my page is updated successfully. This is strange, but... Not a concern for me.
When creating or updating a page, I'm always sending this editor version in the metadata property. This is happens because of that jira issue you linked (CONFCLOUD-68057).
Now that I know this issue really exists, I've changed my program to pass the metadata only when creating, never when updating. This fixed my problem.
Thanks for sharing your findings @Victor Wolkers .
I believe this is a bug that needs further investigation. From a first search, the behavior looks similar to:
However, I will run some tests and in case I will proceed creating a new bug ticket for this issue.
I will share my findings in here.
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am actually not able to reproduce the issue even using the first format for the editor you were using.
This is the payload I have been sending:
{
"title":"Updated using rest api",
"type":"page",
"space":{
"key":"XXX"
},
"status":"current",
"body":{
"storage":{
"value":"<p>This is a page UPDATED using REST API</p><p>Link: <ac:link><ri:page ri:content-title=\"NEW TEST DE CAZ\" ri:version-at-save=\"6\" /></ac:link></p>",
"representation":"storage"
}
},
"version":{
"number":4
},
"metadata":{
"properties":{
"editor":{
"value":"v2"
}
}
}
}
As a response I get status code 200 followed by:
{"id":"63461XXXXX","type":"page","status":"current","title":"Updated using rest api","space":{"id":380XXXXXX,"key":"XXX","name":"xxxxx","type":"global","status":"current","_expandable":{"settings":"/rest/api/space/XXX/settings","metadata":"","operations":"","lookAndFeel":.......................
Now, one assumptions I can do (that will need to be verified) is that the editor property is not working well with wiki representation.
Would it be an option to try to use storage format when passing the editor property and see if this works?
Another thing I noticed, the error message on your side is about not being able to update the content property editor:
Error occurred when updating content property editor. Cannot update content property
Can you kindly check (using the Get content by ID REST API endpoint) if the page is currently set to use editor v1 and this is why you get the error?
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strangely, I was not able to reproduce the error again. I changed the representation to "storage" and it updated successfully.
Then, I changed the program to send the metadata even when updated and it updated successfully. I even rolled back to the json without the "key" property and it updated successfully. Then, in a desperate attempt to reproduce the error, I created a new page with the "wrong" metadata and tried to update it. Everything worked.
My only guess now is that something was fixed in between tests.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can see that a fix for the REST API endpoint to copy pages has been released this week and maybe there was a code-change that fixed this issue as well. That's my only guess too :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Victor Wolkers ,
Welcome to the Atlassian Community!
If I understand correctly you are updating Confluence pages using REST API and this is failing if you also add the editor property returning error 400. However everything works fine if you omit this property. Is this correct?
Now, if my understanding is correct, can you kindly confirm which one of the 2 endpoints are you using?
Also, looking at the workaround for CONFCLOUD-68057 (Creating a page via API doesn't load the New Editing Experience) I can see that the syntax specified in there is the following:
"metadata":{
"properties":{
"editor":{
"key":"editor",
"value":"v2"
}
}
}
While the syntax in your request is:
"metadata":{ "properties":{ "editor":{ "value":"v2" } } }
Can you kindly try to add the "key":"editor" part to your request body and see if this works?
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your reply, @Dario B.
First of all, yes, you are correct on all of your assumptions. I'm sorry that I made a mistake and wrote "POST" instead of "PUT". I am updating a content, not converting a content body. I will update my question to correctly point that out.
Secondly and sadly, your solution did not work. I get the same bad request result as follows:
PUT /wiki/rest/api/content/{id}
{"title":"{title_omitted}","type":"page","space":{"key":"{space_omitted"},"status":"current","container":{"id":"{id_omitted}","type":"page"},"ancestors":[{"id":"{id_omitted}"}],"body":{"storage":{"value":"{value_omitted}","representation":"wiki"}},"version":{"number":3},"metadata":{"properties":{"editor":{"key":"editor","value":"v2"}}}}
Response
{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: Error occurred when updating content property editor. Cannot update content property. Property : JsonContentProperty{id='null', key='editor', content=ExpandedReference{idProperties={id=ContentId{id={id_omitted}}, status=current, version=ExpandedReference{idProperties={number=3}, of=some(Version{by=null, when=null, message='null', number=3, syncRev='null', syncRevSource='null', ncsStepVersion='null', ncsStepVersionSource='null', confRev='null', content=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Content}})}}, of=some(Content{id='ContentId{id={id_omitted}}', type=page, title='{title_omitted}', status=current, space=ExpandedReference{idProperties={key={space_omitted}}, of=some(Space{key='{space_omitted}', name='null'})}, history=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.History}, version=ExpandedReference{idProperties={number=3}, of=some(Version{by=null, when=null, message='null', number=3, syncRev='null', syncRevSource='null', ncsStepVersion='null', ncsStepVersionSource='null', confRev='null', content=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Content}})}, ancestors=[Content{id='ContentId{id={id_omitted}}', type=null, title='null', status=current, space=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Space}, history=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.History}, version=EmptyReference{referentClass=class com.atlassian.confluence.api.model.content.Version}, ancestors=null (CollapsedList), container=EmptyReference{referentClass=interface com.atlassian.confluence.api.model.content.Container}, childTypes={}}], container=ExpandedReference{idProperties={}, of=some({id={id_omitted}, type=page})}, childTypes={}})}, version=null} , isSuccessful: false, isAuthorized: true, isValid: false, hasErrors: true, Errors: \"jsonproperty.version.required\""}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.
Register today!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.