How to remotely set Space Status via XML-RPC
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
This guide demonstrates a way to change your space status from "Current" to "Archived", or vice versa. We will be utilizing the setSpaceStatus
from Remote Confluence methods to change the status of the target space.
Please do keep in mind that the XML-RPC and SOAP APIs are deprecated since Confluence 5.5. However, the
setSpaceStatus
will work for us in this particular case.
Solution
On the Confluence server, open up command-line interface and execute the following cURL command:
curl --user $USRNAME:$USRPWD -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{ \"jsonrpc\" : \"2.0\", \"method\" : \"setSpaceStatus\", \"params\" : [ \"$SPACEKEY\", \"$STATUS\"] , \"id\": 1 }" $CONFURL/rpc/json-rpc/confluenceservice-v2?os_authType=basic 2>/dev/null | python -mjson.tool
You will need to fill in the following argument according to your environment:
- $USRNAME:$USRPWD as the username and password (seperated by a colon) of an administrator user
- $SPACEKEY as the target space key
- $STATUS as either "CURRENT" and "ARCHIVED". (Set "CURRENT" to have the space in active state, Set "ARCHIEVED" to archive the space)
- $CONFURL as the URL of your Confluence Server
Example and expected result: