Hi,
In my space, I have defined 3 statuses. Is there an REST API I can use to set any of these 3 statuses to a specified page?
The create and update page APIs only allows current or draft statuses to be passed.
Thanks
Hi @Alin Oana
I was able to find the below information
To set a Confluence page's "content state" (which is what Confluence refers to as "page status" in the UI) using the REST API, you can utilize the PUT method on the /rest/api/content/{id}/state endpoint.
Code
PUT /wiki/rest/api/content/{id}/state
{id}: The ID of the Confluence page you want to update.contentState object. This object includes properties like name (the status name, e.g., "Draft", "Archived"), color, and isSpaceState.Example (using Curl)
curl -u <username>:<password_or_api_token> -X PUT \
-H "Content-Type: application/json" \
-d '{
"name": "Archived",
"color": "green",
"isSpaceState": false
}' \
<your_confluence_base_url>/wiki/rest/api/content/<page_id>/state
-u <username>:<password_or_api_token>: Authenticates your request. For Confluence Cloud, an API token is recommended.-X PUT: Specifies the HTTP method.-H "Content-Type: application/json": Indicates that the request body is in JSON format.-d '{...}': Contains the JSON payload defining the new content state.
"name": The desired status name (e.g., "Current", "Deleted", "Historical", "Draft", "Archived")."color": (Optional) The color associated with the status."isSpaceState": (Optional) A boolean indicating if this is a space-level state.<your_confluence_base_url>/wiki/rest/api/content/<page_id>/state: The full URL to the content state endpoint for the specific page. Replace <your_confluence_base_url> and <page_id> with your actual values.
I hope this helps!
Thanks,
Anwesha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anwesha Pan, hi. Not the answer, but rather an obvious question:
any idea how to get the current status of the page?
GET /api/content/<page_id>/state request does not work (does not exist), and the
GET /pages/{id} request does not contain this data (there the status shows the State of the page (archive, current))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Pavel Ulan
Thanks for your question, did you try the below option?
GET /wiki/rest/api/content/{id}/state (id: The ID of the Confluence page)
Below is a Request example (using CURL)
curl -u YOUR_EMAIL:YOUR_API_TOKEN \
https://YOUR_CONFLUENCE_DOMAIN.atlassian.net/wiki/rest/api/content/YOUR_PAGE_ID/state
YOUR_EMAIL:YOUR_API_TOKEN: Replace with your Atlassian account email and an API token generated from your Confluence profile.YOUR_CONFLUENCE_DOMAIN: Replace with your Confluence Cloud instance's domain (e.g., example.atlassian.net).YOUR_PAGE_ID: Replace with the numerical ID of the Confluence page you want to query.Thanks,
Anwesha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Exactly, I didn't even think to look at API v1.
Thank you so much @Anwesha Pan =)
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.