Inconsistencies with page title case sensitivity

Page titles in Confluence are supposed to be case-insensitive. No two pages with the same title but different casing are allowed in the same space. And page references using the wrong casing are resolved properly. An example is when adding an Include Macro to a page. In the macro editor, the title of the included page can be typed in, and when typing it in wrong casing and saving without selecting one of the suggested pages, the Include Macro gets stored with an ri:page reference to the included page using the wrong casing, but it renders properly anyways.

Our use case is that we are fetching a page using the REST API, parsing the storage format, and replacing all the Include Macros with the content of their referenced pages. This has turned out to be a bit of a pain, because it turns out that the Confluence REST API seems to be case-sensitive about page titles whereas all other parts of Confluence are not.

For example, let’s assume we have a page “Page” in space “TEST” in our Confluence instance. Trying to access it using /rest/api/content?spaceKey=TEST&title=page or /rest/api/search?cql=title=page or /rest/api/content/search?cql=title=page does not return any results.

We have implemented a workaround that relies on CQL’s fuzzy search. We are looking up the page using /rest/api/search?cql=title=page (replacing the characters -?~"*:\ with a space in the page title, since those have a special meaning in the query). This is case-insensitive, but it also might return other pages whose title contains the word “page”. So what we do is fetch all the results (multiple result pages if needed) and then manually do a case-insensitive title comparison with all the pages returned in order to find the right one.

While this workaround works, it is not ideal, as sometimes pages are missing from the search index, and it can be much slower if the search returns a lot of results that have a similar page title.

There might be other fields that are not handled case-insensitively by the REST endpoints as well. The only thing that I have tested is the space key, and it seems that that is handled correctly.

Interestingly, it seems that on Server, the /rest/api/content endpoint behaves the opposite way: The space key is case sensitive, while the page title is not. The CQL endpoint behaves the same as on Cloud.

6 Likes

The rest API also has inconsistencies if group names contain a slash “/”, see e.g. [CONFCLOUD-68869] group API method cannot fetch group names with a slash - Create and track feature requests for Atlassian products.

Some of this has changed on Cloud and I have done a deeper investigation: Finding a page by title

2 Likes

CONFCLOUD-72826
vote for this to get Atlassian to document the difference for Cloud.

2 Likes