Page status set through API call

Pawel Wozniak July 20, 2022

Hi folks,

I saw that Atlassian gave us recently a new feature that allows us to set the Confluence page status -> https://support.atlassian.com/confluence-cloud/docs/add-a-status-to-your-page-or-blog/

The feature is very useful however, I would like to automate things and let this status be added/updated via API call. Is it possible? I tried to monitor the payload that is being sent when setting the status in the page creator but couldn't find anything related. Pls, help me

Thank you in advance!

2 answers

0 votes
Tobias Meyer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 14, 2024

Hello @Pawel Wozniak 

I found out a way how to set a page status with 2 API calls. It's not documented and I don't know what happens in the background but so far it looks like that it works. 

1. API Call:

HTTP POST
https://<SITE>.atlassian.net/cgraphql?q=SetContentStateMutation

body:

[
{
"operationName": "SetContentStateMutation",
"variables": {
"contentId": "<PAGE ID>",
"contentStateInput": {
"color": "<HEX COLOR>", //#2684FF=blue, #57D9A3=green, #FFC400=yellow, #FF7452=red, #8777D9=purple
"name": "<STATUS NAME"
}
},
"query": "m
utation SetContentStateMutation($contentId: ID!, $contentStateInput: ContentStateInput!) {\n  setContentState(contentId: $contentId, contentState: $contentStateInput) {\n    name\n    color\n    id\n    restrictionLevel\n    __typename\n  }\n}\n"
}
]

* you can put in any color with its hex code but only the official ones are recognized. If you put a different hex color as one provided by Atlassian the circle on the page status will get your color but the background color of the status will stay blue.  

 

2. API Call:

HTTP PUT
https://<SITE>.atlassian.net/wiki/rest/api/content/<PAGE ID>/?status=draft&action=publish

body:

{
"type": "page",
"title": "<PAGE TITLE>",
"space": {
"key": "<SPACE KEY>"
},
"version": {
"number": <NEXT PAGE VERSION NUMBER>,
"minorEdit": <true || false>,
"message": "<MESSAGE>"
}
}
 
Please replace all <PLACEHOLDERS> with your data. 
Again this is not official. I found this out through reverse engineering.
Best regards 
Tobias
0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2022

Hi @Pawel Wozniak ,

it seems that this feature is not yet available through REST API. There is the following api https://developer.atlassian.com/cloud/confluence/rest/api-group-content-states/#api-wiki-rest-api-content-id-state-put but, based on status list, it seems not related to status page feature.

Fabio

Pawel Wozniak July 20, 2022

Thank you for the answer.

Do you know if there is any channel where I could push it as feedback or kind of a feature request? This is really useful but in my case, I would love to have it available through the API.

Like Nikki DuBois likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events