I'm creating a new space and copying content from a 'template' space using the API. This works fine but it does not set the correct page as an home page. Trying to update the homepage using the API I always get an error 400:
url: https://myconfluence.atlassian.net/wiki/rest/api/space/test
Using a PUT
Payload:
{
"homepage": {
"id": "801603851"
}
}
I always get this error:
{
"statusCode": 400,
"data": {
"authorized": true,
"valid": false,
"errors": [
{
"message": {
"translation": "Cannot update space homepage to page in space with key: TEST",
"args": []
}
}
],
"successful": false
},
"message": "Cannot update Space"
}
If I chagne the homepage in the GUI to the same page it does work. Any idea?
OK I found the issue myself and I think it is a bug in the API.
If I use this URL: https://myconfluence.atlassian.net/wiki/rest/api/space/test it fails
If I use this URL: https://myconfluence.atlassian.net/wiki/rest/api/space/TEST it works
For some reason the PUT seems to be case sensitive for the space name. (even if the error message specifically says "TEST" and not "test" in the error message)
If I do a GET content (https://myconfluence.atlassian.net/wiki/rest/api/space/test/content) it does work no mather if I use "test" or "TEST" in my call
Hello Alexandre,
This is correct that space keys are case sensitive within the REST API. There is a bug request created for this exact issue which may be found at CONFSERVER-40303. We would suggest you vote and watch this request to receive future updates on its status.
Excellent work finding the issue and being able to update your Confluence space with a new home page.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Stephen, the bug is for server and I'm using cloud. Also the API seems inconsistent. I have used many REST API call using... Also this bugs dates back to 2015, so I have no hope of seeing it solved...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alexandre,
I was under the impression we're working on the server platform. I have updated this post to reflect its applicable for the cloud platform.
This issue has not been reported for Confluence cloud so I have gone ahead and opened a bug request on your behalf for this issue (which is a confirmed issue). You may find this request at CONFCLOUD-66502.
Thank you for bringing this to our attention and working with us to find the problem and confirm it.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Alexandre and welcome to the Community!
Thank you for sending over what your goal is along with the endpoint you’re using and the response you received. I tested this within Confluence cloud and was able to change my landing page within a space (The page must exist within the same space to be set as a landing page). I used the following curl cmd to adjust my space landing page:
curl -v -u username:token -X PUT -H 'Content-Type: application/json' -d '{"homepage":{"id":"12312309","type":"page","status":"current","title":"New Landing Page"}}' https://myconfluence.atlassian.net/wiki/rest/api/space/test
Could you please test this against your instance (ensuring the landing space exists within the same space it’s being set within) and let us know the results?
We look forward to hearing back to ensure you’re able to just space landing pages via the REST API.
Regards,
Stephen Sifers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Stephen,
I change my header to be like you suggested
{
"homepage": {
"id": "801603851",
"type":"page",
"status":"current",
"title":"New Landing Page"
}
}
and i get the same 400 error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.