I have a strange behaviour which I would like to understand and work around.
We are using Confluence Data Centre edition and have very many (O(100)) spaces in it.
I am using the REST API to manage content in some of the spaces. Authorization is done via Personal Access Token, using the "Authorization: Bearer ..." header.
This works for _some_ of our spaces, but not all, and in particular not for recently created spaces. Some give valid 200 responses, and some just give 404's like this:
{"statusCode":404,"data":
{
"authorized":false,
"valid":true,
"allowedInReadOnlyMode":true,
"errors":[],
"successful":false
},
"message":"No space found with key : <space_name>","reason":"Not Found"
}
I suspect a pagination issue... but that doesn't sound right, according to the REST API documentation.
Can someone help me understand why some of my spaces are being found by key, and some not?
Thanks,
Probably, you don't have permissions or the right permission to those spaces.
I thought that too, but I do indeed have permission. The Personal Access Token might not have permission, but according to the docs, it's emitted with the same permissions as the user. So if I can see the space browsing as a user, then I should be able to see the space calling the REST API as well.
Is there a flaw in that logic?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the logs on the server when executing the API call, see if something in the logs provides a clue on the 404 errors
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.