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.

 

3 answers

0 votes
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 21, 2025
0 votes
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 20, 2025

Hi @Roma Bubyakin _Wombats Corp_ and anybody looking here....

 

I actually got a Scriptrunner Listener and Macro pretty well configured:

 

Screenshot 2025-02-21 at 08.15.22.png

 

But I stopped due to the fact (and built in automation has the same) - The event "page updated" or "page status changed" fires after the page is persisted with the content status.

So - When my automation - or Scriptrunner listener - sets the content status back from "Verified" to "In Progress" - the will be an extra Page version (14) shown as "Verified" in the History, but it has actually changed from the actually verified (13):

Screenshot 2025-02-21 at 08.22.01.png

 

 

 

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

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 19, 2025

Thanks @Roma Bubyakin _Wombats Corp_ 

 

No, not optimal - and {{page.version}} is not a smart value (a feature request do exist for it)

And im not sure how to get that into a WebRequest body...

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events