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.
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.
PUT
/rest/api/content/{id}/state
Code
PUT /wiki/rest/api/content/{id}/state
{id}
contentState
name
color
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>
-X PUT
-H "Content-Type: application/json"
-d '{...}'
"name"
"color"
"isSpaceState"
<your_confluence_base_url>/wiki/rest/api/content/<page_id>/state
<your_confluence_base_url>
<page_id>
I hope this helps!
Thanks,Anwesha
@Anwesha Pan Thank you! It worked.
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 theGET /pages/{id} request does not contain this data (there the status shows the State of the page (archive, current))
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
<strong>YOUR_EMAIL:YOUR_API_TOKEN</strong>
<strong>YOUR_CONFLUENCE_DOMAIN</strong>
example.atlassian.net
<strong>YOUR_PAGE_ID</strong>
Exactly, I didn't even think to look at API v1.Thank you so much @Anwesha Pan
It looks like you're new here. Sign in or register to get started.