Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Set space homepage using API - CLOUD

Alexandre Marcoux
Contributor
May 3, 2019

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?

2 answers

0 votes
Alexandre Marcoux
Contributor
May 8, 2019

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

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 8, 2019

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

Alexandre Marcoux
Contributor
May 8, 2019

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...

Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2019

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

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 7, 2019

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

Alexandre Marcoux
Contributor
May 8, 2019

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events