Usually, content properties are stored as valid JSON; thus, you can display single properties using a JSON path. However, the JSON value for both content-state-published and content-state-draft are not valid JSON… they are escaped.
The content-state-published property will appear on the view page, and the content-state-draft will appear in the draft. When the page is published, a published property identical to the latest draft property will become the published property. The set endpoint above will automatically publish the page if the status query param is set to current.
I’ll look into the escaped JSON and the reasoning for it, or if it’s a bug.
@LukasGotter If I understand the situation correctly, you can set the page state through the API, but you can’t set the page status through the API.
Confusingly it seems the page status is called contentState in the JSON.
@LukasGotter Indeed. The endpoints available through wiki/rest/api/content are about the page state.
Page (content) status is newer, but the confusing thing is that it is called contentState and not contentStatus in the JSON.
@LukasGottercontentState is in the quoted JSON, i.e. if you GET e.g. metadata.properties.content_state_published
So there is the state like draft, published. And there is the page (content) status in quoted JSON, which is called contentState.
Hello @LukasGotter. I came across this post while experimenting with your content properties editor and macros. I’ve managed to display the current content status (state) value using a single content property macro like this:
However - I was wondering if you’ve figured out a way to get the name of the user who last modified the content status? That would be quite useful in page property reports, for example. I’m thinking the “setterAAID” element might be a user identifier? Any idea if/how that could be converted to a user name?? If not - maybe that’s an enhancement of some sort you can consider for the content property macro?
Also - I guess your macro only returns the “value” element. Would there be a way to get the “version” (and specifically, the “when” element)? That would allow a page property report to show the current content state, along with when it was set and who set it!
The issue with the escaped property has been fixed on our side by supporting both escaped and unescaped JSON values.
@TonySileo Yes, you can also display the version of the content state. Use “$.version” to display the version. Currently, only raw values are possible but if there is enough interest we might allow different renderings (user, dateTime, …). Let us know your use case. Hope this helps!
Thanks @LukasGotter. yes - I figured I could get the version and setterAAID, but my use case is to add a Page Property macro where the value for certain page properties is extracted from the content properties, and then can be displayed in a page properties report that shows status, status change date, and who changed the status for an entire hierarchy of labeled pages. Something like this:
Except the Status Changed By would be much more useful as a person’s name or link to their profile.
As I think about this more, I also realize the version, date, and setterAAID from the current content properties will always represent the most recent change to the page, which might not be when the page’s content status (state) was last changed. I guess the only way to get that would be by trolling through the page history to find when it changed, and then grabbing the version, date, and setterAAID from that version of the page. That’s probably a bigger ask - so I get it if you can’t support that!
Resolving the user’s full name would require the app to use additional permission to access the user API (doable but needs to be verified and tested).
Are you sure the content state value and version attributes will be updated with a new version number, even if they there is no change to the content state? Not sure about the history, do you know how to access it? A macro to display the content state alongside the person who changed it would indeed be useful. @TonySileo
I just confirmed that the version number in the content-state-published property increments each time someone publishes a new version of the page, regardless of whether the content state (status) changes.