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!
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": "mutation 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>"
}
}
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
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 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.