Labels Aren't Retrieving Owners When Using Remote API
Platform Notice: Cloud and Data Center - This article applies equally to both cloud 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
Symptoms
The Confluence API method getLabelsByDetail(null, null, null, AuthenticatedUserThreadLocal.getUsername())
returns empty results.
Cause
The method getLabelsByDetail() is actually looking into LABEL table, instead of CONTENT_LABEL.
As you are trying to retrieve Global Labels that a user has added (by passing in the owner name), it is an expected behavior that empty result is returned. The Global Label's owner is not recorded in the LABEL table.
Resolution
Labels are stored in the following tables:
- CONTENT_LABEL
- LABEL
In CONTENT_LABEL, it stores the usage of a label ( e.g where does a label belongs to). You can find the label OWNER who created the label in this table.
However, LABEL stores the label's properties (e.g : owner of a personal label, label's namespace) and it stores unique label. As you can notice from LABEL, global (namespace) label does not have OWNER recorded. That's because, the same label (global label) can be used across different pages. In another words, that could be different author/owner of the same label. Thus, the author/owner is recorded in CONTENT_LABEL table instead of LABEL.