Getting Content status (for vesions)

Normann P_ Nielsen _Netic_
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.
February 14, 2025

I can easaly get:

 

 

/wiki/api/v2/pages/9111140/versions

/wiki/rest/api/content/9111140/state

 

But the latter only shows current state  and I cant find a combi or any extensions as in:

 

wiki/api/v2/pages/9111140/versions?expand=metadata.properties.content_state_draft,metadata.properties.content_state_published

 

To get the historical "content status'es".

The goal is to find the latest "verified":

Screenshot 2025-02-14 at 12.50.01.png

And show it in a (Scriptrunner) macro on the page or similar...

Any good ideas for the last part - feel free - I cant find any native macros supporting such a thing.

 

1 answer

0 votes
Roma Bubyakin _Wombats Corp_
Contributor
February 19, 2025

Hello @Normann P_ Nielsen _Netic_ 

I was also not lucky enough to find a way to get historical status.

Seems that a possible solution is to store the status each time on change in the page properties. E.g.:

{
"key": "lastVerififedVersion",
"value": "12"
}

It might be possible with the automation

Untitled.png

...however, I doubt that it would be an easy task, if realistic.

1. Web request to the properties endpoint required username:token pair

2. There is no "upsert" endpoint. If no such property yet you have to create it:

POST https://{base}.atlassian.net/wiki/api/v2/pages/{pageID}/properties/
{
"key": "lastVerififedVersion",
"value": "12"
}

3. Update requires valid incremented version and accessible with property ID

PUT https://{base}.atlassian.net/wiki/api/v2/pages/{pageID}/properties/{propertyID}
{
"key":"lastVerififedVersion",
"value": "15",
"version": {
"number": 2
}
}

It seems too tricky for automation, but a normal task for ScriptRunner or the custom forge app.

P.S. a bit easier it works with API v1 with property key instead of ID:

GET https://{base}.atlassian.net/wiki/rest/api/content/{pageID}/property/lastVerififedVersion

Regards, Roman

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events